From e0df002a64dccbe9f0180a0481b7e9f29ee5ccbf Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Tue, 22 Apr 2014 11:33:06 +0200 Subject: [PATCH] More fun-n-games with timezones in the scheduler --- Duplicati/Server/Scheduler.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Duplicati/Server/Scheduler.cs b/Duplicati/Server/Scheduler.cs index af4cf7dbe..79fb78c89 100644 --- a/Duplicati/Server/Scheduler.cs +++ b/Duplicati/Server/Scheduler.cs @@ -222,7 +222,7 @@ namespace Duplicati.Server } //If time is exceeded, run it now - if (start <= DateTime.Now) + if (start <= DateTime.UtcNow) { var jobsToRun = new List(); //TODO: Cache this to avoid frequent lookups @@ -249,7 +249,7 @@ namespace Duplicati.Server // passed the current date and time //TODO: Make this more efficient int i = 50000; - while (start <= DateTime.Now && i-- > 0) + while (start <= DateTime.UtcNow && i-- > 0) try { start = GetNextValidTime(start, start.AddSeconds(1), sc.Repeat, sc.AllowedDays); @@ -268,7 +268,7 @@ namespace Duplicati.Server foreach(var job in jobsToRun) m_worker.AddTask(job); - if (start < DateTime.Now) + if (start < DateTime.UtcNow) { //TODO: Report this somehow continue; @@ -302,7 +302,7 @@ namespace Duplicati.Server if (scheduled.Count > 0) { //When is the next run scheduled? - TimeSpan nextrun = scheduled.Min((x) => x.Value) - DateTime.Now; + TimeSpan nextrun = scheduled.Min((x) => x.Value) - DateTime.UtcNow; if (nextrun.TotalMilliseconds < 0) continue;