Journal

Engineering

Two hours behind

When the server lives in one timezone and the field in another, every timestamp becomes a small lie. Why timezone handling is a system property, not a bug ticket.

3 min read

Field 14:00 LOCAL ZONE Server 12:00 ANOTHER ZONE THE RECORD TRAVELS AND CHANGES ITS TIME NO ERROR, NO WARNING BOTH SIDES PASS THROUGH ALIGNED One absolute scale STORED ONCE · DISPLAYED PER VIEWER WHICH DAY · WHICH SHIFT · WHEN THE PROMOTION STARTED
Field and server clocks differ by the zone offset; storing time once, on one absolute scale, puts every visit and delivery on the right day.

The bug report was the kind that makes support laugh before it makes them sweat: an order timestamped two hours before the rep entered the store. Either the rep had learned to sell backwards through time, or something structural was wrong with how the system understood clocks.

It was, of course, the clocks. The application servers ran in a data centre in one timezone. The field ran in another. Whenever the mobile app sent an event without an explicit date, the receiving service stamped it with its own local time - the server’s time, two hours away from the truth. Every photo, every check-in, every document created through that path carried a timestamp that was consistently, quietly wrong by the same offset.

The mistake we almost made

What makes this story worth telling is not the bug. Off-by-a-timezone is as old as distributed computing. What is worth telling is the shape of the mistake we almost made, because it is the shape of a mistake made everywhere: treating a systemic property as a series of client tickets.

The first time an offset like this surfaces, it looks like one customer’s problem, because that customer happens to run reports that compare visit times with order times. The natural response is a patch for that client’s configuration, and when “the same bug again” shows up in another deployment, another patch. It takes stepping back to see the truth: every deployment where the server’s zone differs from the field’s zone has this problem, whether anyone has noticed yet or not. On local servers the offset is zero, so the bug is always there, invisible, waiting for geography.

One fix in the shared layer

That reframing changes the fix. A per-client patch is a promise to repeat the work forever. The systemic fix - one utility in the shared layer through which every application writes time, so that what the field records is what the record keeps - is done once and holds for the next deployment in the next country. It is the same logic the platform follows elsewhere: built once, shared across markets. The attempt to solve it purely on the backend failed first, which is its own lesson: the write path had too many doors, and the only place all of them passed through was the shared application layer. The fix went where the chokepoint actually was, not where the architecture diagram said it should be.

Local defects and system defects

There is a wider rule hiding in this, and it applies far beyond clocks.

When the same defect appears for the second client, stop and ask what class it belongs to.

Some defects are local: this configuration, this data, this customer’s odd process. Others are properties of the system meeting the world - timezones, encodings, currency rounding, fiscal formats, the assumption that names fit in one field. Class-two defects disguised as class-one tickets are among the most expensive things in software operations, because each patch closes a symptom and preserves the cause, and the cause compounds with every new market.

Distribution software in this region will always live across zones - a server in one country, depots in another, a field team crossing borders before lunch. Time is not metadata here. It decides which day a delivery belongs to, which shift gets credited, whether a visit happened inside working hours, when a promotion legally started. A system that is two hours wrong about everything is wrong about everything, politely.

The clocks now agree. The rule that outlived the fix: when a bug arrives with a customer’s name on it, check whether it is actually carrying a passport.

Incident anonymized; deployment details omitted.

Time with the customer is the metric

Kilometres, calls and visit counts are easy to measure and easy to fake. Closest to revenue is the number nobody tracked: minutes spent with a customer.