The millennium bug revisited
Network Time ProtocolA widely used date/time format is that deployed by the Internet Network Time Protocol [NTP], which uses 64 bits. This consists of two 32-bit fields: seconds and fractional seconds. Fortunately the seconds field is unsigned, so it has a span of 136 years. The theoretical resolution of NTP is 2-32 seconds (233 picoseconds), which addresses almost any conceivable application. Unfortunately, the NTP epoch starts on 1 January 1900, which means that the rollover will occur in 2036.
Although the choice of epoch start for NTP was a little short-sighted, the documentation for its use addresses this issue. It suggests that “Implementations should disambiguate NTP time using knowledge of the approximate time from other sources.”
64 bits to the rescue
It is obvious that the problem of the limited capacity of a 32-bit register can be simply addressed by using a 64-bit format instead. Since 64-bit CPUs are now being deployed in embedded designs, this sounds like a sensible way forward.
Just storing seconds in a 64-bit format provides a span that extends to twenty times the estimated age of the Universe. That would be a similar level of overkill to the IPv6 addressing scheme, which accommodates the possibility for the assignment of a unique IP address to every particle in the known Universe.
Various proposals have been put forward for a standard 64-bit time format, some of which have been deployed. Commonly this involves storing either milliseconds or microseconds since an epoch, which might be 1 January 1970 or 1 January 2000. Any of these would provide a minimum span of 300,000 years, which is overkill, but not ridiculous.
We have a quarter of a century to address the 2038 Problem. Over that
time, many systems will become obsolete, as lifetimes of devices get
shorter and they are replaced. Fixing the code in systems with “31-bit
time” should just be a matter of inserting the keyword unsigned in
strategic locations, but I hope the work is performed with a little more
care than that.I have no idea what systems are likely to fail. By that time, I will be about 80, hopefully retired, and my main interest may be the integrity of medical instrumentation.
Anyway, we have lots of time to get this fixed – just like we did last time.
Colin Walls has over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, Colin is an embedded software technologist with Mentor Embedded (the Mentor Graphics Embedded Software Division), and is based in the UK. His regular blog is located at: http://blogs.mentor.com/colinwalls. He may be reached by email at colin_walls@mentor.com.


Loading comments... Write a comment