From 89133255d3501fc0d39d4eb7cb34524a78682746 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Sun, 2 Nov 2025 09:38:18 -0600 Subject: [PATCH] fix classic schedule start time calculation across a UTC offset change (#2593) * fix classic schedule start time calculation across a UTC offset change * update changelog --- CHANGELOG.md | 3 ++- .../Scheduling/PlayoutModeSchedulerBase.cs | 20 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0faf0746c..246cbc5d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,8 +22,9 @@ 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 +- Fix some file not found songs missing from trash view ### Changed - Use smaller batch size for search index updates (100, down from 1000) 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}",