From fe4c859c832e5099f9af8864f369f527b1fbfd82 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Sun, 2 Nov 2025 09:35:30 -0600 Subject: [PATCH] fix classic schedule start time calculation across a UTC offset change --- CHANGELOG.md | 1 + .../Scheduling/PlayoutModeSchedulerBase.cs | 20 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0faf0746c..0baedb5c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Properly set explicit audio decoder on combined audio and video input file - Fix building sequential schedules across a UTC offset change - Fix block start time calculation across a UTC offset change +- Fix classic schedule start time calculation across a UTC offset change - Fix XMLTV generation for channels using on-demand playout mode - Fix some removed songs from appearing in the trash diff --git a/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs b/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs index 019d171ca..61a06de2f 100644 --- a/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs +++ b/ErsatzTV.Core/Scheduling/PlayoutModeSchedulerBase.cs @@ -60,16 +60,16 @@ public abstract class PlayoutModeSchedulerBase(ILogger logger) : IPlayoutMode TimeSpan itemStartTime = scheduleItem.StartTime.GetValueOrDefault(); DateTime date = startTime.Date; - DateTimeOffset result = new DateTimeOffset( - date.Year, - date.Month, - date.Day, - 0, - 0, - 0, - TimeZoneInfo.Local.GetUtcOffset( - new DateTime(date.Year, date.Month, date.Day, 0, 0, 0, DateTimeKind.Local))) - .Add(itemStartTime); + var withStartTime = new DateTime( + date.Year, + date.Month, + date.Day, + 0, + 0, + 0, + DateTimeKind.Unspecified).Add(itemStartTime); + + DateTimeOffset result = new DateTimeOffset(withStartTime, TimeZoneInfo.Local.GetUtcOffset(withStartTime)); // Serilog.Log.Logger.Debug( // "StartTimeOfDay: {StartTimeOfDay} Item Start Time: {ItemStartTime}",