The missing hour
A tiny timezone returns the right clock time but marks an ambiguous hour incorrectly.
What’s going wrong
A timezone converter works for zones with many transitions. A zone with only one backward transition produces a wrong `fold` marker, making round trips ambiguous.
Use integer seconds, not system dates. Input JSON contains `zone.before`, its offset before the first transition; `zone.transitions`, sorted `[utc_instant, new_offset]` pairs; and `timestamps`, UTC seconds to convert. For each timestamp print `[local_seconds, active_offset, fold]`. At a transition instant, the new offset is active. `fold` is 1 only in the second occurrence of wall times after a backward jump; it becomes 0 at the end of that repeated interval. With no transitions, use `before` and fold 0. Print one compact JSON array.
All offsets and times are small signed integers. Investigate both transition history and interval boundaries.
Expected behavior
Offset lookup and repeated-interval detection work for zero, one, and multiple transitions, at and on both sides of each boundary.
Reproduction
{"zone":{"before":0,"transitions":[[100,-30]]},"timestamps":[99,100,110,129,130]}[[99,0,0],[70,-30,1],[80,-30,1],[99,-30,1],[100,-30,0]]
{"zone":{"before":0,"transitions":[[100,20]]},"timestamps":[99,100,105]}[[99,0,0],[120,20,0],[125,20,0]]
Before you begin
- Lists and indexing
- Time offsets
- Repeated local time (defined in report)
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.