The Unix Clock Overflow in 2038
(Looking for a freelance software developer? You found one. Visit the home page.)
Tuesday, January 19, 2038, 03:14:07 GMT
Another "Y2K"?
Remember the Y2K brouhaha? If programs weren't written to correctly handle the transition from December 31, 1999, to January 1, 2000, disastrous consequences were feared. Yet the alarmists' predictions didn't come to pass.
I predicted that Y2K wouldn't be a big deal. First, many computers don't care what today's date is. (For example, does your car know or care? No.) Second, I thought the alarmists were being purposefully vague, refusing to distinguish major disasters from minor nuisances. (For example, if you get a bank statement that was obviously printed recently, but says "January, 1900", would that destroy the fabric of society? No.)
But another clock anomaly is on its way, and this one could be much more serious.
Unix systems count the number of seconds since January 1, 1970. That value will eventually overflow the number of bits used to store it. The clock will roll-over, causing the system to think it's January 1, 1970 again. If the value is interpreted as signed (i.e., 2's compliment), the new date will be long before January 1, 1970.
At the roll-over, the huge discontinuity from the last second will throw off any time-based calculation, too. (For example, velocity, acceleration, or projected position.)
Like Y2K, the original programmer's foresight is the biggest factor. If (s)he allocated enough bits and handled the sign correctly, it should be fine--if the operating system returns enough bits to begin with. Conversely, even if the operating system returns enough bits, if the programmer didn't store them (and use them in each calculation), the problem will occur.
Win32 (i.e., Windows) machines can be affected, too, since they emulate the Unix time functions for many applications.
Of particular concern are older systems (like PDP-11's) running software that hasn't been touched in years.
Watch it approach
Today is:
Watch these (and yours) count down:
You Try It
Play around with it yourself. Enter the number of bits. Specify signed/unsigned. Hit the button to add your value to the bulleted list above.
More information
- 2038bug.com -- A site devoted to the Year 2038 bug, by Paul Sheer.
- Wikipedia's entry: Year 2038 problem
Brought to you by J. C. Bell & Associates, Inc. (View our disclaimer .)
Previous page: The Dreaded C4786 Warning (MS Visual C++ 6)