12-12-2012, 03:53 PM
C programming language
C programming language.doc (Size: 72 KB / Downloads: 29)
. 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 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.
The year 2038 problem (also known as Unix Millennium Bug, Y2K38 or Y2.038K by analogy to the Y2K problem) may cause some computer software to fail before or in the year 2038. The problem affects all software and systems that both store system time as a signed 32-bit integer, and interpret this number as the number of seconds since 00:00:00 UTC on Thursday, 1 January 1970. The furthest time that can be represented this way is 03:14:07 UTC on Tuesday, 19 January 2038. Times beyond this moment will "wrap around" and be stored internally as a negative number, which these systems will interpret as a date in 1901 rather than 2038. This will likely cause problems for users of these systems due to erroneous calculations Further, while most programs will only be affected in or very close to 2038, programs that work with future dates will begin to run into problems much sooner.
For example, a program that works with dates 20 years in the future will have to be fixed no later than in 2018. Because most 32-bit Unix-like systems store and manipulate time in this format, it is usually called Unix time, and so the year 2038 problem is often referred to as the Unix Millennium Bug. However, any other non-Unix operating systems and software that store and manipulate time this way will be just as vulnerable.
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 calculating time values.
It is the basis for the C Time and C TimeSpan 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 theinteger, 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-
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 63072000 seconds.