When Unix Clocks Hit 10-Digits Will Anything Break?
dannycarroll asks: "I've not heard this mentioned yet so I'll bite.
This weekend (depend on where you live) the Unix system clock hits 1.000.000.000 seconds since the Unix Epoch.
I heard about one or two applications that are vulnerable to a date overflow but I am wondering how many more are out there, unknown.
It's not the Y2k bug and consequences are far from it, but it seems to me that there has been too little attention paid to this potential problem.
As an example, I wonder how many Perl scripts out there use 9 digits for the date-stamp field instead of a delimiter?" I've been hearing about this from several different directions and it took me by surprise. I would think that most programs out there are using time_t or at least 32-bit integers by now if they are storing seconds-since-the-epoch (you would think we actually had learned something from the Y2K chaos). Are there any well known programs that might break because of this?
Lets be honest, I hope there are problems as it'll make things more interesting around here. But, I think there isn't much chance of that, as anyone clever enough to be using time_t to store stuff, isn't then going to whack it into a 9 character long string..... One hopes.
There's a lot of validation done on date strings (i.e. check it's 9 digits). For example, there's a lot of code out there that creates filenames based on this 9 digit string, and then there's apps that load up those files. There's also cookies that get set based on the epoch seconds. Any sanity checking that looks for a 9 digit integer is going to go bang. I've come across some of that code where I work. I'm sure other people will too, and it's all too easy to ignore due to the lack of hype surrounding the 1e9s bug.
Matt. Want XML + Apache + Stylesheets? Get AxKit.
This article on KDE Dot News describes the the 1,000,000,000th second bug in KMail < 1.0.29.1. The problem stems from the index file format used (the time stamp is a 9-char fixed-width field). The index files (and therefore the mail folders) become corrupted when the time value is >= 10^9. This doesn't have anything to do with time_t, which on 32-bit systems is slated to roll over sometime in 2038. Systems with 64-bit timestamps (like pre-X Mac OS and VMS) won't roll over for the next 20,000 years.
In Soviet Russia, Jesus asks: "What Would You Do?"
Of course, since there are lots of more competant programming geeks than me, I'm sure that most of the good software out there will be okay. (Or at least I hope so)
"You spoony bard!" -Tellah
I doubt there's a lot of software that explicitely depends on the date being nine digits. It's not like the Y2K bug, where the most convenient form to manipulate the date was often as a string. People using the Unix time for their date would normally find it easier to manipulate the value as an integer. As long as they stick to that they're fine.
Where there might be problems (and I'm guilty of doing this) is where the developer took advantage of the fact that dates sorted alphabetically also happen to be sorted temperally. Say you save dated information in files and incorperate the timestamp in the file name. When you read the file name back in it's a string. If you need the most recent data, it's tempting to sort it as a string and pick off the last item (especially if you're using Perl which makes this sort of manipulation really easy). Unfortunately string comparisons will stop working on Saturday ("1000000000" 999999999).
It is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail. - Abraham Maslow
Unix time overflow (signed or unsigned) may be some years away, but why wait, especially now that an ever-increasing amount of goods contains processing power.
Using 64-bit time, with the 2^63 pivot point (0x80...00) set at the current epoch of 1/1/1970, would allow a 64-bit time id for each second in human history: plus or minus 2.9 exp 11 years (if my arithmetic is correct).
Or perhaps the gurus think that our current concepts of timekeeping will become obsolete in the next 30 years: maybe a second is too granular ....
(I am aware that VMS used 64-bit time, but that was nanoseconds, IIRC, and would run out far too soon!)
I forget to escape my "<" at the end there. That should say: ("1000000000" < "999999999", although 1000000000 > 999999999).
It is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail. - Abraham Maslow
That same code review turned up another ignorance-borne gem.
If you look at this, it's actually almost ingenious. But no seasoned programmer would write this, since it all boils down to sprintf (spTime, "%d", pTime);. There's no substitute for experience.
Which brings me back to my point. How much code must there be out there that was written by low-level programmers who are assigned the simpler and more tedious sections of the code? Usually the architects and designers concentrate on the "big picture" and most difficult sections of code, but invariably there are parts left for the junior developers, who by definition are still on the road to programming common sense.
So we are bound to see this manifest. Most likely, like y2k, nothing critical will fall over and blow up. But also like y2k, we'll be finding the cosmetic (and more occasionally, serious) consequences of this bug in all sorts of places, and for quite some time.
--
I don't want to rule the world... I just want to be in charge of mayonnaise.
http://www.inwap.com/pdp10/usenet/julian-day
marotti.com
Make sure you create a cron entry which will email you a reminder when the 64-bit limit is approaching so you can fix your code.
These people with flaky hardware and/or flaky administrators are providing a valuable service and testing bunches of applications for us. This does provide uneven coverage, applications for the clueless get the most wrong date testing. The headers say that message from 2094 was sent with Microsoft Outlook Express 5.50.4133.2400.
Sun has released a technical bulletin on this. It doesn't appear to be NDA or confidental, but then again, they don't always label their stuff. (I had a problem with that once. Not even a copyright notice. They screamed and yelled when the document hit the net.)
l
They do, however, reference the following URL at the end of the bulletin --
http://www.mitre.org/research/y2k/docs/TIME_T.htm
All UNIX systems store the UTC+0 time, so they will
all overflow at the same time.
( of course in reality many systems are misconfigured,
so they will overflow "sooner-or-later" )
stein