2038 problem and potential fixes for it.

308 views

I understand the issue itself and when I read the Wikipedia it has list of solutions at the bottom that numerous different programing languages and programs have implemented. Are these solutions widespread? Is the issue itself sort of overblown with how technology exists today?

In: 0

5 Answers

Anonymous 0 Comments

Computers count time starting at 0 and counting up every second until it reaches 2^31 -1 seconds.

What we agreed on as the starting point was January 1st, 1970 at 0:00 UTC. That’s why computers default to this time when there is no value (or December 31st, 1969 if you live in the Western Hemisphere)

January 19th, 2038, at 3:14:07 UTC is exactly 2^31 -1 seconds from January 1st, 1970, at 0:00 UTC

Now, why is 2^31 -1 the magic number? That’s because the way computers store the current time is as a 32-bit integer. More modern systems already in use use a 64-bit integer and can run until 2^63 seconds, which is about 292 billion years.

I’ll use a 4-bit example to explain what happens during the overflow.

0 is 0000

1 is 0001

2 is 0010

3 is 0011

4 is 0100

5 is 0101

6 is 0110

7 is 0111 (this is 2^3 -1)

But then we get to 1000, which is -8

1001 is -7

1010 is -6

And so on until 1111 is -1

That first number is called the sign bit because if it’s 0, the number is positive (or 0), and if it is 1, the number is negative.

So when we got to 7 (2^3 -1) the next number it tries to go to is 8, but 8 doesn’t exist, so it thinks the number is -8 and then starts counting up from there.

When the clocks do this, they will get to January 19th, 2038, they will then overflow and go back 2^31 seconds before January 1st, 1970, which is some time in December 1901.

The very same issue happened with YouTube view count for Gagnam Style reached 2^31. It was the first video to do so, and YouTube didn’t catch it in time, so briefly the view count for the video was in the -2 billions (continuing to count up, towards 0) until YouTube switched to storing views as a 64-bit integer.

The easiest solution is to switch time to a 64-bit integers, but people are also suggesting other solutions, including a 64-bit integer counting milliseconds, and it will only last 292 million years rather than billion.

This is exactly what people thought would happen with the Y2K bug (serious people, not the doomsday paranoia) and some systems were susceptible to that, but the 2038 problem is much more wide spread, but we’re also getting a jump on it much sooner.

You are viewing 1 out of 5 answers, click here to view all answers.