# 19 Jan 2038 (Problem) date structure

Discussion in 'Programmer's Corner' started by vaidhya, Mar 18, 2008.

1. ### vaidhya Thread Starter New Member

Jan 3, 2008
6
0
19-Jan-2038, 03:14:07 AM GMT 2 147 483 647

By the year 2038,
the time_t representation for the current time will be over 2 140 000 000. And that's the problem. A modern 32-bit computer stores a "signed integer" data type, such as time_t, in 32 bits. The first of these bits is used for the positive/negative sign of the integer, while the remaining 31 bits are used to store the number itself. The highest number these 31 data bits can store works out to exactly 2 147 483 647. A time_t value of this exact number, 2 147483 647, represents January 19, 2038, at 7 seconds past 3:14 AM Greenwich Mean Time. So, at 3:14:07 AM GMT on that fateful day, every time_t used in a
32-bit C or C++ program will reach its upper limit.

When a signed integer reaches its maximum value and then gets incremented, it wraps around to its lowest possible negative value. This means a 32-bit signed integer, such as a time_t, set to its maximum value of 2 147 483 647 and then incremented by 1, will become -2 147 483 648. Note that "-" sign at the beginning of this large number. A time_t value of -2 147 483 648 would represent December 13, 1901 at 8:45:52 PM GMT

Example : Try this

2. Send instant message to anyone - fine its working...

3. Now, change your system date to 19-Jan-2038, 03:14:07 AM or above (as mentioned in mail)

4. Confirm weather your date is changed

5. Again send instant message to anyone...

Even Gtalk has problem

I want a c program that over comes this

2. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
Yes, that's the well-known Y2038K bug. Someone will doubtless jigger the Unix/Linux kernel to let this pass unnoticed.

You have 30 years to work on this pressing issue. But, coming here and making a demand - " I want a c program that over comes this" - is a very poor way to start. We don't do code on demand.

Take heart, though. Processors are going to 64 bit registers. That will mean that with no change to the date representation, the sun may have gone to red giant status by the time a 64 bit date rolls over (certainly for 128 bits), and then there won't be anybody left to be concerned.