0% found this document useful (0 votes)
76 views10 pages

Seminar Report 2004 - 2005

The document discusses the Year 2038 problem that will occur on January 19, 2038 when many computer systems that store time as 32-bit signed integers will interpret dates as incorrect due to integer overflow. On this date, the 32-bit Unix time_t value will reach its maximum possible value and roll over to a negative value, causing widespread issues like systems displaying incorrect dates or crashing. The problem arises because the standard C language time library stores time as 32-bit signed integers that can only store dates up to January 19, 2038 before overflowing.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views10 pages

Seminar Report 2004 - 2005

The document discusses the Year 2038 problem that will occur on January 19, 2038 when many computer systems that store time as 32-bit signed integers will interpret dates as incorrect due to integer overflow. On this date, the 32-bit Unix time_t value will reach its maximum possible value and roll over to a negative value, causing widespread issues like systems displaying incorrect dates or crashing. The problem arises because the standard C language time library stores time as 32-bit signed integers that can only store dates up to January 19, 2038 before overflowing.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Seminar Report 2004 - 2005

Y2K38

1. INTRODUCTION

January 19, 2038 will be a serious problem for many platforms, because these

systems will "run out of time". Starting at GMT 03:14:07, Tuesday, January 19, 2038,it is

fully expect to see lots of things breaking magnificently: satellites falling out of orbit, massive

power outages, hospital life support system failures, phone system interruptions, bank

problems, etc. That's because one second later, many of these systems will have wildly

inaccurate date settings, producing all kinds of unpredictable consequences. In short, many

of the dire predictions for the year 2000 are much more likely to actually occur in the year

2038. Most programs written in the C programming language are relatively immune to the

Y2K problem, but suffer instead from the Year 2038 problem. This problem arises because

most C programs use a library of routines called the standard time library (time.h). This

library establishes a standard 4-byte format for the storage of time values, and also

provides a number of functions for converting, displaying and calculating time values. a

signed 4-byte integer has a maximum value of 2,147,483,647, and this is where the Year

2038 problem comes from. The maximum value of time before it rolls over to a negative

(and invalid) value is 2,147,483,647, which


Seminar Report 2004 – 2005

translates into 19-January-2038 at 3:14:08 AM GMT On this date, any C programs that use

the standard time library will start to have problems with date calculations. Because of its

high compactness it is the mainly used embedded software. So y2k38 not only affects the

computers, but also many embedded systems. The year 2000 was just a dry run. In case

you think we can sit on this issue for another 30 years before addressing it, consider that

the temporal echo’s of the 2038 problem are already starting to appear in date calculations

for mortgages and vital statistics. One second later, on 19- January-2038 at 3:14:08 AM

GMT, disaster strikes.


2. WHAT'S SO SPECIAL ABOUT 2038?

Just as Y2K problems arise from programs not allocating enough digits to the year,

Y2K38 problems arise from programs not allocating enough bits to internal time. time_t is a

data type used by C and C++ programs to represent dates and times internally Most

programs written in the C programming language are relatively immune to the Y2K problem,

but suffer instead from the Year 2038 problem. This problem arises because most C

programs use a library of routines called the standard time library (time.h). This library

establishes a standard 4-byte format for the storage of time values, and also provides a

number of functions for converting, displaying and

Dept. of Computer Engg.


W.P.T.C., Kalamassery
Seminar Report 2004 - 2005

Y2K38

calculating time values. It is the basis for the CTime and CTimeSpan classes in MFC.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 147 483 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. After this date, 32-bit clocks will overflow and return erroneous values

such as 1-jan-1970 or 13-dec-1901.as c++ is a powerful programming language it is not

only used as computer software but it is also used in many electronic chips. Because of its

high compactness it is the mainly used embedded software. Satellites, space probe

computers, navigation systems, power plants, atom bombs, missile controllers and many

other important fields contains embedded systems which uses these kinds of chips. So after

19-jan- 2038 these systems will go abnormal.


3. HOW THE TIME AND DATES ARE CALCULATED?

Time_t is actually just an integer, a whole number that counts the number of

seconds since January 1, 1970 at 12:00 AM Greenwich Mean Time. A time_t value

of 0 would be 12:00:00 AM (exactly midnight) 1-

Dept. of Computer Engg.


W.P.T.C., Kalamassery
Seminar Report 2004 - 2005
Y2K38

Jan-1970, a time_t value of 1 would be 12:00:01 AM (one second after midnight) 1-

Jan-1970, etc... Since one year lasts for a little over 31 536 000 seconds, the time_t

representation of January 1, 1971 is about 31 536 000, the time_t representation for

January 1, 1972 is about 63 072 000 seconds.


Some example times and their exact time_t representations:

Date & time


time_t representation

1-Jan-1970, 12:00:00 AM GMT 0

1-Jan-1970, 12:00:01 AM GMT 1

1-Jan-1970, 12:01:00 AM GMT 60

1-Jan-1970, 01:00:00 AM GMT 3 600

2-Jan-1970, 12:00:00 AM GMT 86 400

3-Jan-1970, 12:00:00 AM GMT 172 800

1-Feb-1970, 12:00:00 AM GMT 2 678 400

1-Mar-1970, 12:00:00 AM GMT 5 097 600

1-Jan-1971, 12:00:00 AM GMT 31 536 000

1-Jan-1972, 12:00:00 AM GMT 63 072 000

1-Jan-2003, 12:00:00 AM GMT 1 041 379 200

1-Jan-2038, 12:00:00 AM GMT 2 145 916 800

19-Jan-2038, 03:14:07 AM GMT 2 147 483 647

Dept. of Computer Engg.


Seminar Report 2004 - 2005
Y2K38

By the year 2038, the time_t representation for the current time will be over

2140000000. 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 147 483 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.


One second later, on 19-January-2038 at 3:14:08 AM GMT, disaster
strikes.

4. WHAT WILL THE TIME_T'S DO WHEN THIS


HAPPENS?

Signed integers stored in a computer don't behave exactly like an automobile's

odometer. When a 5-digit odometer reaches 99 999 miles, and then the driver goes one

extra mile, the digits all "turn over" to00000. But

Dept. of Computer Engg.


W.P.T.C., Kalamassery
seminar Report 2004 - 2005

Y2K38

when a signed integer reaches its maximum value and then gets incremented, it wraps

around to its lowest possible negative value. (The reasons for this have to do with a binary

notation called "two's complement"; I won't bore you with the details here.) 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.

So, if all goes normally, 19-January-2038 will suddenly become 13- December-1901

in every time_t across the globe, and every date calculation based on this figure will go

haywire. And it gets worse. Most of the support functions that use the time_t data type

cannot handle negative time_t values at all. They simply fail and return an error code. Now,

most "good" C and C++ programmers know that they are supposed to write their programs

in such a way that each function call is checked for an error return, so that the program will

still behave nicely even when things don't go as planned. But all too often, the simple, basic,

everyday functions they call will "almost never" return an error code, so an error condition

simply isn't checked for. It would be too tedious to check everywhere; and besides, the

extremely rare conditions that result in the function's failure would "hardly ever" happen in

the real world. (Programmers: when was the last time you checked the return value

Dept. of Computer Engg.


W.P.T.C., Kalamassery
Seminar Report 2004 - 2005

Y2K38

from printf( ) or malloc()?) When one of the time_t support functions fails, the failure might

not even be detected by the program calling it, and more often than not this means the

calling program will crash. .

# Set the Time Zone to GMT (Greenwich Mean Time) for date calculations.

for ($clock = 2147483641; $clock < 2147483651; $clock++)

print ctime($clock);
Possibility 1:

Tue Jan 19 03:14:01 2038

Tue Jan 19 03:14:02 2038

Tue Jan 19 03:14:03 2038

Tue Jan 19 03:14:04 2038

Tue Jan 19 03:14:05 2038

Tue Jan 19 03:14:06 2038

Tue Jan 19 03:14:07 2038

Fri Dec 13 20:45:52 1901

Fri Dec 13 20:45:52 1901

Fri Dec 13 20:45:52 1901


Possibility 2:

Tue Jan 19 03:14:01 2038

Tue Jan 19 03:14:02 2038

Tue Jan 19 03:14:03 2038

Dept. of Computer Engg.


W.P.T.C., Kalamassery
Seminar Report 2004 - 2005

Y2K38

Tue Jan 19 03:14:04 2038

Tue Jan 19 03:14:05 2038

Tue Jan 19 03:14:06 2038

Tue Jan 19 03:14:07 2038

Tue Jan 19 03:14:07 2038

Tue Jan 19 03:14:07 2038

Tue Jan 19 03:14:07 2038


Possibility 3:

Mon Jan 18 22:14:01 2038

Mon Jan 18 22:14:02 2038

Mon Jan 18 22:14:03 2038

Mon Jan 18 22:14:04 2038

Mon Jan 18 22:14:05 2038

Mon Jan 18 22:14:06 2038

Mon Jan 18 22:14:07 2038

Mon Jan 1 12:00:00 1970

Mon Jan 1 12:00:01 1970

The output of this script on Windows 2000 Professional

Mon Jan 18 22:14:01 2038

Mon Jan 18 22:14:02 2038

Mon Jan 18 22:14:03 2038

Mon Jan 18 22:14:04 2038

Mon Jan 18 22:14:05 2038

Dept. of Computer Engg.


Seminar Report 2004 - 2005
Y2K38
Mon Jan 18 22:14:06 2038
Mon Jan 18 22:14:07 2038
Bad craziness! The script doesn't print 10 lines of output, there's simply
no date output after 7 seconds

5. WHAT IS THE IMPORTANCE OF TIME?

There is one major aspect of the physical world over which we have no control;

namely TIME. Since this is true, time is usually considered to be the independent variable in

most computer applications, and all other variable quantities are studied and measured with

respect to it. Some familiar examples of physical phenomena that are measured with

respect to time are velocity, acceleration, and frequency.

If we desire to use a computer to control some quantity that varies with time, the

computer must produce output control signals that also vary in accordance with the time

scale of the physical world. This is called “real time “applications. In order to illustrate this

concept, let us consider the case of a navigational control computer. Within the computer,

calculation of distance traveled and present position depends upon instantaneous values of

velocity and direction. Both of these are time varying quantities in the external, real

physical world. Any corrections in speed or azimuth that are made by the
computer in order to compensate for drift must be made on a real time basis.
Previously for convenience when solving problems with computers, liberal use was made of
time-scale factors. The applications of the real-time computation are almost unlimited in
number. Some of these applications, such as gun fire control, automatic navigation, missile
guidance, and machine control etc…..With the advent of the space age, the utilization of
real time computers for aiding navigation in outer space has become essential, since a
human pilot could not possibly solve the complex problems of guidance and control in time
to make the appropriate trajectory corrections. Speeded-up hybrid techniques can be
applied directly to the problems of real-time computation and control. The ever-increasing
demand for faster aircraft and missiles has placed such stringent requirements upon the
computers and techniques in use today.
6. WHAT ABOUT MAKING TIME_T UNSIGNED IN 32-BIT

SOFTWARE?

One of the quick-fixes that have been suggested for existing 32- bit software

is to re-define time_t as an unsigned integer instead of a signed integer. An

unsigned integer doesn't have to waste one of its bits to store the plus/minus signed

for the number it represents. This doubles the range of numbers it can store.

Whereas a signed 32-bit


Dept. of Computer Engg.
W.P.T.C., Kalamassery

You might also like