In response to someone trying to raise the Y2K issue on a local mailing list, I wrote this:
Embedded systems, those that are most likely to have catastrophic effects when they fail, generally don't use much base 10 and have rollovers fairly frequently.
And when someone asked for elaboration, responded with this:
In embedded systems, especially those coded more than a decade ago when people still thought that software would be obsoleted by the turn of the century, memory is usually a constraint, and code simplicity is valued.
Computers don't do base 10 well; 2 digits is handy if you're storing everything in ASCII, but if you're storing numbers or dates, ASCII is a very wasteful format. On a system I built a decade ago (a group health insurance marketing tool), we fit every day in the century into the same two bytes that these COBOL weenies put the year in.
Furthermore, there's a computational disadvantage to storing numbers as ASCII. Manipulating two digit ASCII means you have to load the second byte, subtract 48 from it, multiply it by 10 (or shift it left two, add it to itself, and shift the result left one, which is faster on many embedded processors) load the first byte, subtract 48 from it, and add it to the result of the calculation on the second byte.
Embedded systems would much rather work with numbers in a native form, which means that rollovers tend to happen around numbers like 255 and 65535. The other thing this means is that using a time encoding which uses {12 months in a year}/{28-31 days in a month}/{24 hours in a day}:{60 minutes in an hour}:{60 seconds in a minute}.{1000 milliseconds in a second} is ludicrous. Even if programmers are asked to output numbers in this format, they're never going to use such a format internally.
Generally they'll use some arbitrary time base. On embedded systems based on IBM PC hardware they'll often keep time by counting 18.2 clock ticks per second, because that's a number the PC hardware keeps fairly reliably. Other systems will use milliseconds. Unix uses seconds since 1970 in 32 bits for low resolution clocks (this will wrap sometime in the century after next). That aforementioned insurance system kept everything in days since mid April 1900, but those databases have been superceded so far as I know.
If you keep a 2 byte time field based on, say, milliseconds, you'll get a rollover just over every minute. No problem, because if you've designed your system using that resolution you're never comparing events that happen more than 60 seconds apart, so you let the rollover happen, and because you've kept the comparison to two bytes, and you know which direction time is flowing, the overflow doesn't matter.
(Quick exercise: 150 - 80 is 70. 50 - 80 is -30, if you add 100 to this (ie: ignore the overflow), you get the same 70 with two digits rather than three. Most systems I've written which depend on relative time work like this.)
When the overflow is a little further apart, sometimes system designers allow for a small sample time of unstable values. For instance, the Global Positioning System has a rollover in the week field which uses 10 bits (0 to 1023) a little more than every 19 years, this next happens between the weeks August 15, 1999 and August 22, 1999. Since GPS depends on some very tiny differential measurements, there may be some inaccurate displays in the seconds surrounding that rollover. But anywhere GPS is tied into a navigation system (no critical civilian applications use GPS as a primary source, there may be some weapons systems), that small glitch will be less than the usual noise.
The other thing is that most embedded systems that I've seen don't care what time it is. They care how long something has taken, but starting and stopping points are pretty much arbitrary, unlike accounting systems.
The big issues in our infrastructure are the utilities: Telephones, electricity, water, gas, radio communications.
Telephones have rollovers regularly.
The water and gas meters are still read from a mechanical device in your house.
Radios don't care what time it is.
Electricity is the big one, and the one everyone's harping on. I can only speculate, as I'm not terribly knowledgeable about the grid, but the big issue with electricity is matching up a 60Hz phase with various distant generators. I can't imagine that this is a counter that doesn't roll over regularly. There have been some recent spectacular disasters showing what can cascade through the power system from fairly small failures, Auckland New Zealand and the big west coast power outages last summer come immediately to mind, so I don't think everything's going to be entirely trouble free, but at worst we'll lose power for a week or two.
Since all critical civilian applications have backup (hospitals and most medium sized businesses and broadcast media have their own power generation systems), the worst that happens is that January is a fun street party where we at long last get away from our TVs and actually meet our neighbors.
Sure, come April we may have some accounting issues to work out, the phone company may claim we're behind a century and two months in our bills, but those are easy problems unrelated to the actual function of the various networks, and on the average we're as likely to have our banks tell us we've earned an extra century's interest.
The other thing that calms my nerves is that unlike us modern-day city dwellers, especially here in the cushy environment of California, I've lived "out there". I remember losing power for a week when I was growing up. I've spent several weeks living out of a pack. Contrary to the scare-mongering of the various news organizations, when survival is threatened, people tend to band together and help each other. Pessimists are occasionally right short term, but long term the optimists always win. I don't know how common it is now, but as recent as a decade ago there were regions of the US that didn't have phone or electrical service, and they got along just fine. We're talking about losing luxuries we've deemed "essential" for less than half a percent of written human history.
For less than my lifetime, and I'm a young whippersnapper.
Certainly the designs, if not the construction, of most of our houses predate these problems.
Absolute worst case? Yes, the world is massively overpopulated, which means that, yes, if we were to drop back to a 1900 level of technology there would be some uncomfortable adjustments. But the amount of the U.S. population engaged in activities not even remotely related to our personal survival is so big that we've got huge resources to fall back on. Any dark spots just aren't going to last that long. And in my experience, those who thrive in the world aren't the ones who hole themselves up waiting for the sky to cave in, but the ones who seek out change and adapt to the environment.
Tuesday, August 18th, 1998 danlyke@flutterby.com