
Leap Seconds, Unix Time and the Year 2038 Problem
An incident timeline shows a worker accepting a request just before the gateway says it sent it. Both timestamps end in Z. The timestamps already use UTC, so I would start by checking the clocks and tracing the request across both services. A timestamp can carry the right format and still be wrong by enough to confuse the order of events.
Systems have several jobs to do before that timeline is trustworthy. They need a clock that stays close to a reference and a representation that can hold the date. Occasionally, they also need an agreed policy for an extra second. These problems often show up in the same logs, but each leaves different evidence and calls for a different check.
What happens in a leap second
Atomic clocks provide steady seconds. The Earth's rotation varies, so the time derived from that rotation does not move in perfect step with them. A positive leap second has been used to keep UTC close to time based on the Earth's rotation. When one is inserted, UTC goes from 23:59:59 to 23:59:60 and then to 00:00:00 on the next day.
Systems can handle an insertion differently. Some repeat a clock reading, while others spread the correction over a longer interval by temporarily changing the clock rate. That second method is called a smear. If two services follow different policies, they may disagree about the current time during the correction even when both were in close agreement beforehand. Keep the policy consistent across systems that exchange timing-sensitive records.
What Unix time counts
Unix time represents time relative to the start of 1 January 1970 UTC, a point called the epoch. Ordinary POSIX counting treats each day as 86,400 seconds. It gives the inserted second no distinct integer of its own between adjacent seconds. When you need to account for every physical second across an insertion, an ordinary Unix timestamp alone leaves out information about what happened at the boundary.
Unix time is handy for storage and comparison because a number can represent an instant without reference to a city. Write down the unit when systems pass those numbers around. A value in milliseconds read as seconds can land far outside the expected date range. In an incident note, I prefer a full, readable timestamp with a zone designator. It saves the reader a conversion while they are looking for the event.
Where the year 2038 limit comes from
A signed 32-bit integer can hold at most 2,147,483,647. When used to store seconds since the Unix epoch, its highest value means 03:14:07 UTC on 19 January 2038. The next second falls outside the range. Depending on the software, the value may be rejected or it may produce a date in December 1901. This is the year 2038 problem.
Many systems can already store seconds in a wider integer. The path a timestamp takes can still include an older field. A service might accept a long-dated renewal while the device responsible for acting on it stores seconds in 32 bits. Trace the value from entry through storage and export to the final consumer. A correct value at the first step tells you little about what the last step can hold.
Test dates a business can enter today
A long lease or certificate can cross the boundary years before the calendar does. Use a test record just before the limit and another just after it, then read both back where staff would normally see them. Also check the system that sorts upcoming work. A date sent back to 1901 can surface as overdue, while a rejected date may simply leave the renewal off the work list.
Ask engineering to check the width and units of each field on that path. Pay attention to old file formats and equipment with long service lives. Replacing the main database column is one change. If an export still writes a narrower field, the receiver still has a problem. Keep the test values in a controlled environment so that a trial renewal does not turn into a live task.
Use NTP to keep hosts close to a reference
Network Time Protocol, or NTP, lets a computer exchange timing messages with time sources and estimate the difference between its own clock and theirs. A time service uses those estimates to correct the local clock. The estimates allow for travel time over the network, though uneven delays can introduce error. A machine that has lost contact with its sources can keep running while its clock drifts. An office can notice this after a network interruption, when a terminal still stamps every transaction but its readings have slipped away from those on the server.
Check whether a host is synchronised and how far its clock is estimated to be from the reference. The acceptable difference depends on the work. A report assembled once a day may tolerate an error that spoils a trace comparing requests a fraction of a second apart. I look at the host's recent clock status when UTC event records suggest an order the service could not have followed.
Measure durations with a clock meant for intervals
A wall clock shows when an event happened. It can be corrected while work is in progress. If a slow clock steps forward during a ten-second request, subtracting its two wall-clock readings overstates how long the request took. A backward correction can even make a short request appear to finish before it started. For a timeout or elapsed-time measurement on one machine, use a monotonic clock, which is designed to avoid wall-clock jumps. Keep a UTC timestamp for the investigation record. The two measurements answer different questions about the same request.
Across machines, carry a request identifier so the records can be joined even when clocks disagree. If a gateway sent a request that a worker later accepted, that relationship survives a small error in the clocks. The timestamps still help locate the problem in the larger incident. Together with the request record, they give the next shift a timeline it can check against what the systems actually did.