My curiosity recently brought me to analyse what is the exact nature of the 2038 date problem.
Well as you all probably know, it comes from the limitation in the C standard library type 'time_t' which is usually defined as a 32 bits signed integer.
The time_t type is defined by the C standard to contain "the number of seconds elapsed since January 1, 1970, 00:00:00". The C documentation says it can contain dates up to January 18, 2038, 19:14:07.
But when I calculate the number of seconds a 32 bits signed integer can contain, I come to the number 2147483647, which is 24855 days, 3 hours, 14 minutes and 7 seconds. Adding this value to January 1, 1970, 00:00:00 gives the following date: January 19, 2038, 03:14:07
So how can you explain the difference between the C documentation date and the calculated date ?
Start Free Trial