A deadline in business hours depends on the time zone of the calendar. A ticket created at 23:00 in Cairo is the middle of the afternoon in New York. Twice a year, clock changes make this harder. This guide explains how our service-clock library documents time zones, and why it mentions a data package called tzdata.
This guide describes behaviour documented for our local service-clock library (version 0.1.1). It describes our own tool, not a statement about any customer machine, business or result. The documentation states that no Windows test of this library was run and none is claimed.
Two Modes
- Without a time zone, the calendar is floating and naive: plain wall-clock times, no clock changes.
- With a named time zone, times must be timezone-aware. The documentation says SLA minutes are real elapsed minutes inside local-clock business windows, and that this is correct across daylight-saving changes.
What a Clock Change Does
When clocks go forward, an hour of local time does not exist. When they go back, an hour happens twice (a “fold”). The documentation says a window edge is the first instant whose local clock reads at or after the configured edge. Inside a gap, that is the jump instant. Inside a fold, it is the first occurrence. A window that lies entirely inside a gap is empty that day.
A Python Trap the Documentation Warns About
Python compares two aware datetimes that share one tzinfo by wall-clock time, which gives the wrong answer inside a fold. The documentation tells you to compare returned datetimes after converting them to UTC.
Where the Zone Data Comes From
Named zones such as America/New_York come from the machine’s time-zone database. Linux normally has it. The documentation says Windows does not, and that a bundled tzdata wheel exists for that case, with instructions in the pack. Without zone data, zone lookups fail.
What Was Tested
- The documentation reports daylight-saving checks against an independent minute-by-minute oracle, with 1,944 checks across 4 seeds and 9 zone and date cases, and no mismatches.
- Only America/New_York and Africa/Cairo are in the regression tests. Other zones depend on the machine’s tz data.
- The standalone suite was run on Linux x86_64 with Python 3.11 to 3.14. No standalone Windows test of this library was run, so named-zone behaviour on Windows was not tested.
Practical Advice
- Pick the zone of the team that owns the promise, and write it into the policy.
- Test your deadline logic around the two clock changes of your zone.
- If you run on Windows, check that zone data is present before you trust a result.