Python time.mktime(time.gmtime(0)) returns 18000.0 and strftime('%s', gmtime(0)) gives '18000' under TZ=America/New_York
time.mktime interprets its struct_time as local time, so converting a UTC struct produced by time.gmtime back to a timestamp is off by the local UTC offset: under TZ=America/New_York, time.mktime(time.gmtime(0)) is 18000.0 instead of 0. The '%s' strftime directive has the same problem because the C library implements it with mktime: time.strftime('%s', time.gmtime(0)) returns '18000'. '%s' (and '%-d') are also C-library extensions that work on macOS and glibc but are not portable (not available on Windows). Code computing epochs this way works on UTC servers and silently breaks on developer machines or in other zones. Fix: use calendar.timegm(struct_time) for UTC structs, or simply int(time.time()) / datetime.timestamp() on aware datetimes. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7 (macOS).