Slashdot Mirror


You've Got 25 Years Until UNIX Time Overflows

CowboyRobot writes "In 25 years, an odd thing will happen to some of the no doubt very large number of computing devices in our world: an old, well-known and well-understood bug will cause their calculation of time to fail. The problem springs from the use of a 32-bit signed integer to store a time value, as a number of seconds since 00:00:00 UTC on Thursday, 1 January 1970, a practice begun in early UNIX systems with the standard C library data structure time_t. On January 19, 2038, at 03:14:08 UTC that integer will overflow. It's not difficult to come up with cases where the problem could be real today. Imagine a mortgage amortization program projecting payments out into the future for a 30-year mortgage. Or imagine those phony programs politicians use to project government expenditures, or demographic software, and so on. It's too early for panic, but those of us in the early parts of their careers will be the ones who have to deal with the problem."

21 of 492 comments (clear)

  1. Could we be a little less biased? by damn_registrars · · Score: 5, Insightful

    those phony programs politicians use to project government expenditures

    The programs are real, even if the math may be phony.

    --
    Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
    1. Re:Could we be a little less biased? by Anonymous Coward · · Score: 5, Insightful

      History shows us that it's not biased in the slightest to assume that politicians will lie, cheat, and steal their way to riches. Giving them the benefit of the doubt is like Charlie Brown giving that field goal one more shot because maybe, just maybe, Lucy won't pull the ball this time.

    2. Re:Could we be a little less biased? by tlhIngan · · Score: 5, Informative

      Actually, banks, and such already ran into Y2K problems in the 70s when long term loans starting overflowing them. For them the Y2K scenario had many years to be fixed slowly (mostly a continuous updating thing - as things broke, they fixed it) so there was no big rush for them as they were experienced in such issues.

      If there are any 2038 issues, the banks have already been ahead of the curve and seeing them in 2008. Hell, a good conspiracy theory....

      time_t has also been 64 bit for a number of years now (you don't need a 64-bit system to deal with 64-bit numbers - it's just dealing with them is a lot slower as the compiler emits library calls to perform the arithmetic). So it's not a real problem even on embedded systems (ARM only added 64-bit support in the ARMv8 instruction set - and only in the high-end A (applications) profile processors - the lower end R (real-time) and M (microcontroller) profiles are still ARMv7 only).

      However, even those compiled with 64-bit time_t aren't necessarily safe - you'd probably find most of them assume it's still a 32-bit quantity and end up storing it as such - ignoring the compiler warnings or casting to get rid of them. So even programs of today with 64-bit time_t's won't necessarily make it past 2038 either.

      And if stuff like that is done, recompiling does diddly - the bug will still strike despite a 64-bit everything. Hell, someone may have decided during the conversio nto increase the timestamp size from 32 to 64 bit, but didn't realize someone squashed it down to 32-bit upstream.

    3. Re:Could we be a little less biased? by Anonymous Coward · · Score: 5, Funny

      For them the Y2K scenario had many years to be fixed slowly (mostly a continuous updating thing - as things broke, they fixed it) so there was no big rush for them

      There's a motorcycle shop in my town where all the receipts are dated "1913". And printed with tractor feed dot-matrix.

      So not everybody's in a big hurry.

    4. Re:Could we be a little less biased? by InterGuru · · Score: 5, Insightful

      We denigrate politicians because they lie, but candidates who tell the truth do not get elected.

  2. Not NetBSD by Nimey · · Score: 5, Informative

    NetBSD has switched to a 64-bit time_t.

    --
    Hail Eris, full of mischief...

    E pluribus sanguinem
    1. Re:Not NetBSD by mrjatsun · · Score: 5, Informative

      > Are you trying to say that "64-bit computers" don't have any support for 32 bit integers?

      The issue is if time_t is a 32-bit int or a 64-bit int. Not if a bit-64 CPU supports 32-bit integers.
      time_t is generally defined as a long across OS implementations.

      In the 32-bit ABI (Application Binary Interface) for most (all?) OSes, a long is a 32-bit value.
      In the 64-bit ABI, a long is 64-bits, so the 2038 time issue does not exist for 64-bit apps.

      So if you are running a 64-bit app, you don't have a problem in that app. One solution is to
      not support 32-bit apps anymore. i.e. you don't support the 32-bit ABI in your 64-bit kernel.
      You can do this easily in linux today (e.g. gentoo, 64-bit only support).

      Another solution is to break 32-bit compatibility (or to define a new 32-bit "ABI") which
      changes the definition of time_t (and some other system types) to be a [u]int64 instead
      of a long.

      So, *if* the parent was suggesting don't support 32-bit apps, then they were right ;-)

    2. Re:Not NetBSD by dingen · · Score: 5, Insightful

      The problem is not so much in computers still being 32 bits in 25 years time, but 32 bit computers right now doing calculations involving dates 25 years in the future.

      --
      Pretty good is actually pretty bad.
    3. Re:Not NetBSD by Zordak · · Score: 5, Funny

      In the 64-bit ABI, a long is 64-bits, so the 2038 time issue does not exist for 64-bit apps.

      Perhaps not, but that Y292e9 bug is going to cause some serious headaches for the Pang-Galactic Empire.

      --

      Today's Sesame Street was brought to you by the number e.
    4. Re:Not NetBSD by lordholm · · Score: 5, Interesting

      The main problem is actually not that the time_t in the OS is 32 or 64, hardware and operating systems are upgraded. And, very few systems shipping today will have 32 bit time_t. This will not be the main problem (even if it will be a problem with some systems, for example, some nuclear reactors are managed by custom unices that are not maintained anymore and they don't dare to touch those systems, but this is solvable in the few cases where this is a problem)!

      The BIG problem for more mainstream software is all the software using binary file formats, such software will completely break down, if time is stored as a 32 bit UNIX time stamp. There may also be problem for text based file formats if for example the reading code uses %d with sscanf to read in the timestamp, but if these are compiled with a modern compiler, the compiler will warn that %d is being used with a 64 bit time_t integer. It is thus solvable, but will require recompiling the software and some minor patching. Binary file-formats will however be a pain in the ass, so bad that software systems will probably have to be certified as Y2038-safe.

      Do not underestimate the size of this undertaking.

      --
      "Civis Europaeus sum!"
    5. Re:Not NetBSD by Sectoid_Dev · · Score: 5, Interesting

      Except that it wont happen for 25 years... FEAR, UNCERTAINTY, CHANGE... RUN!!!!! THE SKY IS FALLING!! (in 25 years)...

      With the acceleration of development that has been occurring over even the last 10 years, I hardly doubt there will be much to worry about 25 years from now.

      You sound like a manager.
      Leave this on the back burner for the next 24.5 years and then drop everything because then the sky is falling.

      I'm glad this issue got mentioned because frankly I don't ever think about the unix epoch time overflowing. It's a good thing to give programmers a nudge for their current(and future) development
        "Hey use 64 bit time values"
          "Oh yeah, sure,"
          25 years later, no problem.

  3. That's OK by Big+Hairy+Ian · · Score: 5, Funny

    The IOS reminder service will fail for the first week in January atleast once before then :)

    --

    Build a Man a Fire, and He'll Be Warm for a Day. Set a Man on Fire, and He'll Be Warm for the Rest of His Life.

  4. I feel like the security guard in Austin Powers... by killfixx · · Score: 5, Funny

    Standing before the steam roller....

    "Stoooooooooooooooooooooooooooooooooooooooooooop".... .... "Stooooooooooooooooooooooooooooooooop"....

    I understand, we need time to correct the issue, but...c'mon?!

    Slow news day?

    --
    "Helping to keep you two steps ahead of the Thought Police!"
  5. Mortgage Calculations by bill_mcgonigle · · Score: 5, Insightful

    Was this a USENET post from '94? Mortgage systems using 32-bit time_t (if there ever were any) failed 5 years ago for 30-year mortgages. We did not hear an earth-shattering kaboom.

    --
    My God, it's Full of Source!
    OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    1. Re:Mortgage Calculations by Anonymous Coward · · Score: 5, Funny

      Actually we did, but it had nothing to do with integer overflow.

  6. Noooooooo! by lxs · · Score: 5, Funny

    My uptime!

  7. Re:64-bit computers DO NOT solve this problem by locofungus · · Score: 5, Insightful

    Compiling away isn't always that simple.

    You'd be amazed how many people code depending on the fact that sizeof(long) == sizeof(int) == sizeof(void*) == sizeof(time_t) == 4 even when they don't need to and structures are often mapped directly onto binary data, either from disk or network.

    I don't actually imagine that 2038 will be much of a problem - most of the issues that will be triggered by the above assumptions will occur between now and then and will be fixed as they occur.

    Then 2038 will loom and there will be a big drive to fix everything (else), the magic time will occur and there will be little more than a whimper. Then everyone will complain about the hype about a non-existent problem.

    I am quite looking forward to having the option of some lucrative consulting income in my early retirement should I decide I need it. :-)

    Tim.

    --
    God said, "div D = rho, div B = 0, curl E = -@B/@t, curl H = J + @D/@t," and there was light.
  8. embedded by Anonymous Coward · · Score: 5, Informative

    64-bit is taking over already everywhere. In 10-15 years, you will have a hard time finding a 32-bit computer.

    The embedded world will still have a lot of 32-bit (as well as 16- and 8-bit) stuff for years to come.

    That's where the big problem will be: not with the systems on your desk (or on your lap, or in your pocket), but rather with the hundreds of little CPUs that you don't see (and you may, or may not, be aware of).

  9. Re:64-bit computers DO NOT solve this problem by HaZardman27 · · Score: 5, Funny

    I am quite looking forward to having the option of some lucrative consulting income in my early retirement should I decide I need it. :-)

    Then my goal is to thwart your retirement plan. I will contract a low-wage programmer from a yet-to-be-determined developing country to write a piece of software that corrects the issue in any source code and recompiles it for you. I'll sell licenses for $1kUSD a pop, which by 2038 will only be enough to cover the cost of a McDonalds Synthetic Cheeseburger Paste from the Value Menu.

    --
    Apparently wizard is not a legitimate career path, so I chose programmer instead.
  10. Re:64-bit computers DO NOT solve this problem by Zordak · · Score: 5, Interesting

    I worked for a DoD contractor in 1999. Our customer had a piece of ground support software for the A-10 that they wanted to make Y2K compliant. Of course, we had to write up a detailed description of the problem and what it might affect so the customer could justify the expenditure to the bean counters. Then we had to write up a preliminary design review to get approval at the high level for what we were going to do. Then we had a critical design review so they could sign off on the detailed implementation of how we were supposed to implement the changes. I based my CDR on the code I had already written to fix the problem. Then I had to put together a testing specification so that we could prove that our date fix didn't destroy the functionality of completely unrelated code. Then we had to go test it on site, do a test report and a final project report.

    Nine month project. I don't remember for sure, but I'm pretty sure that the government spent half a million on the entire program. I was the sole technical actor. I changed something like 20 lines of Pascal code, which took me maybe a week or two. I think I spent more time figuring out how to put together their ancient tool chain than writing actual code. Your government dollars at work.

    --

    Today's Sesame Street was brought to you by the number e.
  11. Re:64-bit computers DO NOT solve this problem by Anonymous Coward · · Score: 5, Insightful

    $0.5M to be air-tight sure that a simple 20 lines of Pascal code doesn't crash one (or more) of the hundreds of A-10s in active service, each one worth $12+M, not to mention keeping those pilots safe.

    Yes. Definitely our government dollars at work.