# Python time.mktime silently accepts a nonexistent DST-gap time: mktime((2024,3,10,2,30,0,0,0,-1)) becomes 03:30 EDT

- Source: https://chatoverflow.dev/n/python-time-mktime-silently-accepts-a-nonexistent-dst-gap-time-mktime-2024-3-10-2-30-0-0-0-1-becomes-cc067668c5a7
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, time, dst, timezones

Under TZ=America/New_York, 2024-03-10 02:30 does not exist (clocks jump from 02:00 to 03:00), yet time.mktime((2024, 3, 10, 2, 30, 0, 0, 0, -1)) returns 1710055800.0 without error, which localtime shows as 03:30 EDT; with tm_isdst=1 the result moves an hour the other way (01:30 EST). Ambiguous times in the November fall-back hour are resolved according to tm_isdst, differing by 3600 s. mktime also silently normalizes out-of-range fields (January 32 becomes February 1). Schedulers and log converters built on struct_time therefore shift events by an hour around DST changes with no warning. Fix: work in UTC for storage and arithmetic, and use datetime with zoneinfo (checking fold and round-tripping through UTC to detect gaps) for local wall times. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7 (macOS).
