r/AskComputerScience • • Dec 09 '25

32-bit computers hit a time calculation wall in 2038. Will they most likely all be phased out by then?

The wall hits 03:14:07 UTC on Tuesday, January 19, 2038. After this the time calculation will roll back over to either December 13, 1901 or January 1, 1970 depending on the implementation. Does anyone think 32-bit architecture computers will still be in service by 2038?

143 Upvotes

138 comments sorted by

View all comments

Show parent comment

2

u/nuclear_splines Ph.D Data Science Dec 09 '25

The Y2K38 Wikipedia article describes the problem fairly well. In short, some older computers will have their clocks "roll over" on the 19th of January 2038 and will read December 13th, 1901. The results will range from "completely unnoticed" to "minor bugs and glitches" to "equipment failure" depending on what the clock is used for.

For example, say you have a computer running the loudspeaker system at a grocery store. Might be totally unaffected by its clock looping over. A cash register? Prints the wrong dates on receipts but otherwise fine. The electric signs at your gas station food mart? Unable to fetch software updates or new images for the signs anymore (if the clock is set wrong then it may not be able to connect anywhere over HTTPS). The elevator at a local business? Well the clock will suddenly read 'Friday' instead of 'Tuesday', so if the business is closed on Fridays and has their elevators set to shut down when the business is closed, maybe someone gets stuck in an elevator.

The trouble is that there are so many types of old devices and software deployed that it's hard to predict what will break and how. We can be confident that it won't be an apocalyptic scenario like many feared Y2K to be. The vast majority of modern computers and software will be fine. But there's so much old gear quietly humming in a closet somewhere, there are doubtless going to be some bumps.

Because this only affects (a subset of) 32-bit computers, your old laptops and phones should be fine unless they're from roughly 2006 or older.

0

u/[deleted] Dec 09 '25

[deleted] — view deleted comment

3

u/xcookiekiller Dec 09 '25

Unix time is signed. The reason is that they started the whole thing roughly in 1970, so considering that 1970 is the "0", they would not be able to express "2 years ago" if they didn't make it signed

1

u/Successful_Box_1007 Dec 10 '25

Can you explain how “signed” allows us to express “2 years ago”? I know what signed and unsigned integers are just learned about those a few months ago but still a bit confused?

1

u/xcookiekiller Dec 10 '25

If 0 = January 1st 1970, then negative numbers are for everything before that point, while positive ones are for everything after that. If it were unsigned, there would be no before.

2

u/ghjm MSCS, CS Pro (20+) Dec 09 '25

The standard signed bumber format, called 2s complement, was designed to have desirable behavior when wrapping around zero (1 minus 2 "naturally" gives -1, without having to encode special logic to handle the sign). The same wrapping at the other end of the scale means that the largest value plus one equals the smallest (most negative) value. A signed 32-bit integer representing seconds gives a positive or negative range of a little over 68 years. The date chosen for zero is Jan 1 1970, so the maximum positive value is in 2038, and when this value is reached it wraps around to the maximum negative value, in 1901. (Some date libraries ignore negative values, in which case it will wrap around to 1970 and either start counting forward or maybe just stay stuck on 1/1/1970 for 68 years, then start counting forward again.)

2

u/flatfinger Dec 09 '25

I wonder why they chose Jan 1, 1970 rather than something like March 1, 1968? Using March 1 as an epoch date means that one can start by dividing the day number by 1461 (computing both quotient and remainder). Another similar but more puzzling choice was the Apple classic Macintosh, which uses unsigned dates, but chose January 1, 1904 as its epoch date.

2

u/ghjm MSCS, CS Pro (20+) Dec 09 '25

By all accounts it was an arbitrary choice by the early Unix team. Can you explain what you mean about dividing by 1461?

2

u/flatfinger Dec 09 '25

Every group of 4 years has 1461 days, at least until 2099.

1

u/Langdon_St_Ives Dec 09 '25

What does this buy the cpu?

2

u/flatfinger Dec 09 '25

If one uses March 1 as the epoch, leap day will be the last day out of each group of 1461 days.

2

u/Langdon_St_Ives Dec 09 '25

Still fail to see what this buys us. It’s already trivial to work out leap days during the limited time range you specify, and only marginally less trivial beyond that.

2

u/flatfinger Dec 09 '25

It's not terribly hard either way, but the code ends up being a little simpler, and January 1 isn't really any less arbitrary than March 1. What's weird is that the new year was changed from March 21 to January 1 rather than March 1 (note that what we now call the ninth through twelfth months are named as the seventh through tenth months).

1

u/Successful_Box_1007 Dec 10 '25

Hmm but if time moves forward and our clocks only need to show forward time, I still don’t grasp why we even need negatives and need 2s complement instead of just unsigned. Sorry if this is relatively easy just curious why?

1

u/ghjm MSCS, CS Pro (20+) Dec 10 '25

Some applications need to refer to dates in the past. Like, suppose you have a date of birth field. (Though you generally wouldn't use a Unix style date for that.)

2

u/Awkward-Feature9333 Dec 09 '25

Wrong dates on receipts can probably end you in prison for tax fraud, so those aren't insignificant.

4

u/ghjm MSCS, CS Pro (20+) Dec 09 '25

Criminal convictions require intent though

3

u/Langdon_St_Ives Dec 09 '25

If your tax receipt reads 1901 instead of 2038 I think you’ll have a very easy case. Starting with the fact that neither the printer printing the receipt nor whatever product or service you paid for existed in 1901.

2

u/Awkward-Feature9333 Dec 09 '25

I'm not a lawyer, in no jurisdiction.

If the law states what your receipts need to show, and that includes date of sale (which it does in most jurisdictions I believe), maybe it's not exactly tax fraud, but you will still face consequences.

2

u/Langdon_St_Ives Dec 09 '25

IANAL either but I’m pretty sure you won’t face any serious consequences for amounts typically appearing on cash registers, except in authoritarian states, where you have to be prepared for grave consequences for anything you do, wrong or not.

1

u/Successful_Box_1007 Dec 09 '25

Amazing explanation I just have two followup questions:

Why rollback to December 13th 1901 specifically?

How could actual crashes occur? Is it a kernel thing?

2

u/nuclear_splines Ph.D Data Science Dec 09 '25

Why rollback to December 13th 1901 specifically?

We have settled on a standard of tracking time on computers using the Unix epoch, defined as "the number of seconds that have elapsed since midnight, January 1st, 1970, 0 UTC." If you store Unix time in a signed 32-bit integer, the maximum value occurs at 3:14:08 UTC on January 19th, 2038, which is 231 - 1 seconds since the epoch. It will then roll over to the minimum value, -231 seconds before the epoch, which is 20:45:52 UTC on 13 December 1901.

So, the answer to why that date specifically is "a combination of what we chose as our zero date, how we track time, and how signed integers are implemented."

How could actual crashes occur? Is it a kernel thing?

The kernel shouldn't crash, but other software might. An extremely likely candidate is TLS. When you connect over HTTPS (or connect to a WPA enterprise wifi network, or connect to a mail server over SMTPS or IMAP, or...) your computer receives a certificate and checks whether it's valid. TLS certificates are always valid for a specific date range, so if your clock is wildly off your computer will report "this certificate is invalid" and refuse to connect. Any software that tries to make a secure network connection will fail.

So in the electric signage example, if the first thing the computer does is say "download the image I'm supposed to display on my sign," and it can't download the image, you get a blank screen or an error message. The operating system hasn't crashed, but the device has been rendered useless.

1

u/Successful_Box_1007 Dec 10 '25

Absolute wonderclass of an explanation;

Why rollback to December 13th 1901 specifically?

We have settled on a standard of tracking time on computers using the Unix epoch, defined as "the number of seconds that have elapsed since midnight, January 1st, 1970, 0 UTC." If you store Unix time in a signed 32-bit integer, the maximum value occurs at 3:14:08 UTC on January 19th, 2038, which is 231 - 1 seconds since the epoch. It will then roll over to the minimum value, -231 seconds before the epoch, which is 20:45:52 UTC on 13 December 1901.

Q1) But now I’m a bit confused: for example I just got a different laptop and upon startup I had to choose the time zone and it set up the time; so if computers have this raw built in mechanism, why do we need to set the time when we set them up?!

So, the answer to why that date specifically is "a combination of what we chose as our zero date, how we track time, and how signed integers are implemented."

How could actual crashes occur? Is it a kernel thing?

The kernel shouldn't crash, but other software might. An extremely likely candidate is TLS. When you connect over HTTPS (or connect to a WPA enterprise wifi network, or connect to a mail server over SMTPS or IMAP, or...) your computer receives a certificate and checks whether it's valid. TLS certificates are always valid for a specific date range, so if your clock is wildly off your computer will report "this certificate is invalid" and refuse to connect. Any software that tries to make a secure network connection will fail.

Q2) so my laptop - and this is really weird - I keep setting the correct time and sooner or later it separates from the “real time”. If there is this built in mechanism that’s seemingly pretty simply as you explain, why/how does my raw internal clock keep becoming misaligned?

Q3) and you may have just solved a huge dilemma of mine when my clock is out of sync. Given what you said about certificates, is this possibly why sometimes I can’t download updates and other stuff ? (Although I never have trouble browsing the web which uses what called TLS and relies on certificates so that’s weird…) right?

So in the electric signage example, if the first thing the computer does is say "download the image I'm supposed to display on my sign," and it can't download the image, you get a blank screen or an error message. The operating system hasn't crashed, but the device has been rendered useless.

1

u/nuclear_splines Ph.D Data Science Dec 10 '25

upon startup I had to choose the time zone and it set up the time; so if computers have this raw built in mechanism, why do we need to set the time when we set them up?!

You are conflating how computers track time with how they know what time it is to begin with. If you buy a clock it has a perfectly good mechanism for tracking that 26 minutes have passed, but you still need to set it to the correct time to begin with. Likewise, writing down the time as "how many seconds have passed since January 1st 1970" is a fine way to store the date, but doesn't provide the ground truth of knowing what date it is today.

so my laptop - and this is really weird - I keep setting the correct time and sooner or later it separates from the “real time”. If there is this built in mechanism that’s seemingly pretty simply as you explain, why/how does my raw internal clock keep becoming misaligned?

We're only talking about the mechanism for how computers store what time it is. They still have an internal clock that prompts "a second has passed, update the time. Another second has passed, update the time again." That's typically a little oscillating quartz crystal, just like you'd find in a watch. They aren't perfectly accurate, and will slowly drift over time. They'll also lose time if the battery driving them dies or is low on power. Most computers have a separate battery (called the CMOS battery) just for driving the clock and keeping the bios memory intact. Yours may be old and need replacing. Most computers periodically re-sync their clocks using the network time protocol (NTP) to prevent them from drifting too far.

Given what you said about certificates, is this possibly why sometimes I can’t download updates and other stuff

It's unlikely that your clock drift is causing problems for software updates and not for web browsing.