From 177ed969b0360bb91efa8148cbee1bf9df7fb201 Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Tue, 5 Sep 2023 01:12:11 +0200 Subject: [PATCH] Backport of #4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Delay calculation was incorrectly converting using the system timezone. Now using the configured timezone. --- src/CronTimer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CronTimer.cs b/src/CronTimer.cs index 1295a36..00357a8 100644 --- a/src/CronTimer.cs +++ b/src/CronTimer.cs @@ -59,7 +59,8 @@ TimeSpan CalculateDelay() TimeSpan delay; if (tz != UTC) { - delay = Next.ToUniversalTime() - nowUtc; + var nextUtc = TimeZoneInfo.ConvertTimeToUtc(Next, tzi); + delay = nextUtc - nowUtc; } else {