-1

It is about the representation of time by using an int to store the number of seconds since January 1, 1970.

When will programs that use this representation face a time bomb? How should you proceed when that happens?

Ely
  • 10,860
  • 4
  • 43
  • 64

1 Answers1

1

We are 2015 today. The number of seconds approximately since 1/1/1970 is

(2015 - 1970) * 365,25 * 24 * 60 * 60 = 1.420.092.000

That is the number of seconds in 45 years.

An unsigned int (32 bit) can store the value

4.294.967.295

which leaves us with

2.874.875.295 seconds ~ 90 years to go from now on

We still got some time to go.

In case a signed int is used, refer to this link (Thank you PM for the comment).

The signed int can store

2.147.483.647

which leaves us with

727.391.647 ~ 23 years to go from now on, i.e. 2038.

And thus the name of this problem: the Year 2038 problem

That is it can arise before our retirement.

For whatever you are concerned about, please refer to this link on SO.

Community
  • 1
  • 1
Ely
  • 10,860
  • 4
  • 43
  • 64