Update live_information.dart

This commit is contained in:
ImBenji
2024-02-28 06:06:50 +00:00
parent 262aef11ef
commit e8fc41e127

View File

@@ -88,9 +88,11 @@ class LiveInformation {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
if (announcement.timestamp != null) { if (announcement.timestamp != null) {
Duration difference = now.difference(announcement.timestamp!); Duration difference = now.difference(announcement.timestamp!);
if (difference.inMilliseconds <= 100) { if (abs(difference.inMilliseconds) <= 100) {
// Account for the time lost by the periodic timer // Account for the time lost by the periodic timer
await Future.delayed(Duration(milliseconds: 100 - difference.inMilliseconds)); await Future.delayed(Duration(milliseconds: 100 - difference.inMilliseconds));
} else {
return;
} }
} }
@@ -175,7 +177,7 @@ class LiveInformation {
if (announcement is ManualAnnouncementEntry) { if (announcement is ManualAnnouncementEntry) {
// 5 sedonds in the future // 5 sedonds in the future
DateTime scheduledTime = DateTime.now().add(Duration(seconds: 10)); DateTime scheduledTime = DateTime.now().add(Duration(seconds: 60));
final document = databases.createDocument( final document = databases.createDocument(
documentId: appwrite.ID.unique(), documentId: appwrite.ID.unique(),
@@ -485,4 +487,6 @@ class ManualAnnouncementEntry extends AnnouncementQueueEntry {
scheduledTime: scheduledTime, scheduledTime: scheduledTime,
timestamp: timestamp, timestamp: timestamp,
); );
} }
var abs = (int value) => value < 0 ? -value : value;