Fix sunrise wait windows on DST change days

daily_sunrise_video.sh and sunrise-audio-capture.sh added wall-clock
seconds-since-midnight to a midnight epoch, which is 3600s off on the two
days a year the clocks change. Resolve targets with date -d "today HH:MM:SS"
instead. sunrise.py now builds local midnight with tz.localize().

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wi3ZRpfenCe2TRwT4JFMG
This commit is contained in:
Claude
2026-11-02 01:21:57 +00:00
parent e92f189a44
commit 63bbe5c2ab
3 changed files with 16 additions and 11 deletions
+3 -1
View File
@@ -58,7 +58,9 @@ tz = pytz.timezone(conf['TIMEZONE'])
# This bracket is timezone-correct and handles any UTC offset, including large
# positive offsets (UTC+12/+14) where local midnight falls on the previous UTC day.
now_local = datetime.now(tz)
midnight_local = now_local.replace(hour=0, minute=0, second=0, microsecond=0)
# tz.localize (not .replace) so the UTC offset is re-resolved for midnight —
# on a DST-change day now_local's offset differs from midnight's.
midnight_local = tz.localize(datetime(now_local.year, now_local.month, now_local.day))
t0_utc = midnight_local.astimezone(timezone.utc)
t1_utc = t0_utc + timedelta(hours=25) # 25 h covers any timezone's full day