Noon in Which Timezone? — Python Bug Hunt
Inspired by the countless "meeting at noon" disasters of naive timestamp handling.
- Language: Python
- Layer: Backend
- Difficulty: Medium
- Concepts: Timezones, Parsing
- Modelled on: Calendar apps
- Visible tests: positive offsets subtract; negative offsets add; wrapping past midnight stays in range
- Reward: 50 XP for a complete fix
Briefing
Inspired by the countless "meeting at noon" disasters of naive timestamp handling. Feeds send wall-clock times WITH their UTC offset — and the parser throws the offset away, so 12:00 in Mumbai and 12:00 in New York collide.
clocktime.py normalises "HH:MM±OH:OM" to minutes-since-midnight UTC.
Bug report
BUG-TZ-NAIVE · Priority: High · Reported by: scheduling
to_utc_minutes(stamp):
- "12:00+05:30" -> 390 (12:00 IST is 06:30 UTC)
- "09:00-04:00" -> 780 (09:00 EDT is 13:00 UTC)
- wrap into [0, 1440)
Observed: the offset part is ignored entirely.
Logs
[sched] "12:00+05:30" == "12:00-04:00" -> double-booked roomThe code as shipped
src/time/clocktime.py (editable)
# Normalises "HH:MM+OH:OM" (or -OH:OM) to minutes since midnight UTC.
def to_utc_minutes(stamp):
hh = int(stamp[0:2])
mm = int(stamp[3:5])
return hh * 60 + mm
Open the hunt to edit the files, run the visible tests and submit against the hidden ones. More Python bug hunts.