Skip to content

Commit

Permalink
Bugfix on calculating sync interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Jan 11, 2021
1 parent 0c1bbec commit 5aed178
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/OutlookGoogleCalendarSync/Sync/Timer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ public void SetNextSync(int delayMins, Boolean fromNow = false, Boolean calculat
if (Settings.Instance.SyncInterval != 0) {
DateTime now = DateTime.Now;
this.NextSyncDate = fromNow ? now.AddMinutes(delayMins) : LastSyncDate.AddMinutes(delayMins);
if (calculateInterval) CalculateInterval();
}
if (calculateInterval) CalculateInterval();
}

} else {
public void CalculateInterval() {
if (Settings.Instance.SyncInterval == 0) {
Forms.Main.Instance.NextSyncVal = "Inactive";
Activate(false);
log.Info("Schedule disabled.");
return;
}
}
public void CalculateInterval() {

DateTime now = DateTime.Now;
double interval = (this.nextSyncDate - now).TotalMinutes;

Expand Down

0 comments on commit 5aed178

Please sign in to comment.