Time formatting and storage bugs
Encyclopedia
In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, time formatting and storage bugs are a class of software bug
Software bug
A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways. Most bugs arise from mistakes and errors made by people in either a program's...

s which may cause time and date calculation or display to be improperly handled. These are most commonly manifestations of arithmetic overflow
Arithmetic overflow
The term arithmetic overflow or simply overflow has the following meanings.# In a computer, the condition that occurs when a calculation produces a result that is greater in magnitude than that which a given register or storage location can store or represent.# In a computer, the amount by which a...

, but can also be the result of other issues. The most well-known consequence of bugs of this type is the Y2K problem, but many other milestone dates or times exist that have caused or will cause problems depending on various programming deficiencies.

GPS date rollover

In the last few months before the year 2000, two other date-related milestones occurred that received less publicity than the then-impending Y2K problem.

The first problem was related to GPS devices: GPS dates are expressed as a week number and a day-of-week number, with the week number transmitted as a ten-bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

 value. This means that every 1,024 weeks (about 19.6 years) after 6 January 1980 (the GPS epoch
Epoch (reference date)
In the fields of chronology and periodization, an epoch is an instance in time chosen as the origin of a particular era. The "epoch" then serves as a reference point from which time is measured...

), the date resets again to that date; this happened for the first time on 21 August 1999. To address this concern, modernized GPS navigation messages use a 13-bit field, which only repeats every 8,192 weeks (157 years), and will not return to zero until near the year 2137.

9/9/99

The second pre-Y2K milestone occurred in the following month. In many programs or data sets, "9/9/99" was used as a code value
Magic number (programming)
In computer programming, the term magic number has multiple meanings. It could refer to one or more of the following:* A constant numerical or text value used to identify a file format or protocol; for files, see List of file signatures...

 to indicate either an unresolved date or as a terminator to indicate no further data was in the set. This raised issues when the actual date this represents, 9 September 1999, actually arrived.

Two-digit year representations

Follow-on problems caused by certain temporary fixes to the Y2K problem will crop up at various points in the 21st century. Some programs were made Y2K-compliant by continuing to use two digit years, but picking an arbitrary year prior to which those years are interpreted as 20xx, and after which are interpreted as 19xx.

For example, a program may have been changed so that it treats two-digit year values 00-68 as referring to 2000 through 2068, and values 69-99 as referring to 1969 through 1999. Such a program will not be able to correctly deal with years beyond 2068.

For applications wanting to calculate the birth year (or other passed year), such an algorithm has long been used to overcome the Year 1900 problem
Year 1900 problem
The year 1900 problem concerns the misinterpretation of years recorded by only their last two digits, and whether they occurred before or after the year 1900...

, but it has failed to recognise people over 100 years old.

Serial presence detect (SPD) EEPROMs

The SPD
Serial Presence Detect
Serial presence detect refers to a standardized way to automatically access information about a computer memory module. Earlier 72-pin SIMMs included 5 pins which provided 5 bits of parallel presence detect data, but the 168-pin DIMM standard changed to a serial presence detect to encode much...

 EEPROM on modern computer memory modules
DIMM
A DIMM or dual in-line memory module, comprises a series of dynamic random-access memory integrated circuits. These modules are mounted on a printed circuit board and designed for use in personal computers, workstations and servers...

 contains a single-byte binary-coded decimal
Binary-coded decimal
In computing and electronic systems, binary-coded decimal is a digital encoding method for numbers using decimal notation, with each decimal digit represented by its own binary sequence. In BCD, a numeral is usually represented by four bits which, in general, represent the decimal range 0 through 9...

 (two digit) year-of-manufacture code at offset +93 (0x5D). Due to the 18-24 month generational cycle in computer technology this should not be a problem.

Year 2011 in Taiwan

Taiwan
Taiwan
Taiwan , also known, especially in the past, as Formosa , is the largest island of the same-named island group of East Asia in the western Pacific Ocean and located off the southeastern coast of mainland China. The island forms over 99% of the current territory of the Republic of China following...

 (known formally as the Republic of China
Republic of China
The Republic of China , commonly known as Taiwan , is a unitary sovereign state located in East Asia. Originally based in mainland China, the Republic of China currently governs the island of Taiwan , which forms over 99% of its current territory, as well as Penghu, Kinmen, Matsu and other minor...

) officially uses the Minguo calendar
Minguo calendar
The Republic of China calendar is the method of numbering years currently used in the Republic of China . It was used in mainland China from 1912 until the founding of the People's Republic of China in 1949....

, which considers the Gregorian
Gregorian
Gregorian might refer to:* The thought or ideology of Pope Gregory I or Pope Gregory VII *Things named for Pope Gregory I:**Gregorian chant** Gregorian mass**Brotherhood of Saint Gregory...

 year 1912 to be its year 1. Thus, the Gregorian year 2011 is the ROC year 100, its first 3-digit year.

Year 2038

The original implementation of the Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 operating system stored system time as a 32-bit signed integer
Integer (computer science)
In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values....

 representing the number of seconds past the Unix epoch
Unix time
Unix time, or POSIX time, is a system for describing instants in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time of Thursday, January 1, 1970 , not counting leap seconds, which are declared by the International Earth Rotation and Reference Systems Service...

: midnight UTC, 1 January 1970. This value will roll over on 19 January 2038. This problem has been addressed in most modern Unix and Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating systems by storing system time as a 64-bit signed integer, although individual applications, protocols, and file formats will still need to be changed as well.

Year 2042

On 17 September 2042 at 23:53:47.370496 TAI
International Atomic Time
International Atomic Time is a high-precision atomic coordinate time standard based on the notional passage of proper time on Earth's geoid...

, the Time of Day Clock on S/370 IBM mainframe
IBM mainframe
IBM mainframes are large computer systems produced by IBM from 1952 to the present. During the 1960s and 1970s, the term mainframe computer was almost synonymous with IBM products due to their marketshare...

 and its successors, including the current zSeries, will roll over. The UTC
Coordinated Universal Time
Coordinated Universal Time is the primary time standard by which the world regulates clocks and time. It is one of several closely related successors to Greenwich Mean Time. Computer servers, online services and other entities that rely on having a universally accepted time use UTC for that purpose...

 time will be a few seconds earlier, due to leap second
Leap second
A leap second is a positive or negative one-second adjustment to the Coordinated Universal Time time scale that keeps it close to mean solar time. UTC, which is used as the basis for official time-of-day radio broadcasts for civil time, is maintained using extremely precise atomic clocks...

s.

The TOD Clock is implemented as a 64-bit count of 2 microsecond (0.244 ns) units, and the standard base is 1 January 1900. The actual resolution depends on the model, but the format is consistent, and will therefore roll over after 252 microseconds.

The TOD Clock value is accessible to user mode programs, and is often used for timing and for generating unique IDs for events.

While IBM has defined and implemented a longer (128-bit) hardware format on recent machines, which extends the timer on both ends, many programs continue to rely on the 64-bit format which remains as an accessible subset of the longer timer.

Days 32,768 and 65,536

Programs that store dates as the number of days since an arbitrary date (or epoch
Epoch (reference date)
In the fields of chronology and periodization, an epoch is an instance in time chosen as the origin of a particular era. The "epoch" then serves as a reference point from which time is measured...

) are vulnerable to roll-over or wrap-around effects if the values are not wide enough to allow the date values to span a large enough time range expected for the application. Signed 16-bit binary values roll over after 32,768 (215) days from the epoch date, producing negative values. Some mainframe systems experienced software failures because they had encoded dates as the number of days since 1 January 1900, which produced unexpected negative day numbers on the roll-over date of 18 September 1989. Similarly, unsigned 16-bit binary days counts overflow
Arithmetic overflow
The term arithmetic overflow or simply overflow has the following meanings.# In a computer, the condition that occurs when a calculation produces a result that is greater in magnitude than that which a given register or storage location can store or represent.# In a computer, the amount by which a...

 after 65,536 (216) days, which are truncated to zero values. For software using an epoch of 1 January 1900, this will occur on 6 June 2079.

Year 2107

The timestamp stored in FAT
File Allocation Table
File Allocation Table is a computer file system architecture now widely used on many computer systems and most memory cards, such as those used with digital cameras. FAT file systems are commonly found on floppy disks, flash memory cards, digital cameras, and many other portable devices because of...

 filesystems, introduced with MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

, and applications that convert other formats to the FAT/MS-DOS format, will overflow at the end of 2107. The FAT/MS-DOS timestamp is stored in the directory entry with the year represented as an unsigned seven bit number (0-127), relative to 1980.

Year 10,000

The year 10,000 will be the first Gregorian year with five digits. Although many people at first consider this year to be so far distant that a problem of this type will never actually occur, certain classes of calculations in disciplines such as astronomy
Astronomy
Astronomy is a natural science that deals with the study of celestial objects and phenomena that originate outside the atmosphere of Earth...

 and physics
Physics
Physics is a natural science that involves the study of matter and its motion through spacetime, along with related concepts such as energy and force. More broadly, it is the general analysis of nature, conducted in order to understand how the universe behaves.Physics is one of the oldest academic...

 already need to work with years of this magnitude and greater. These applications also have to deal with the Year zero problem
Year zero
"Year zero" does not exist in the widely used Gregorian calendar or in its predecessor, the Julian calendar. Under those systems, the year 1 BC is followed by AD 1...

.

Years 32,768 and 65,536

Programs that process years as 16-bit values may encounter problems dealing with either the year 32,768 or 65,536, depending on whether the value is treated as a signed or unsigned integer.

In the case of the year 32,768 problem, years after 32,767 may be interpreted as negative numbers, beginning with -32,768. The year 65,536 problem is more likely to manifest itself by representing the year 65,536 as the year 0.

"Problems" that aren't problems

Certain problematic years occur so far in the future—well beyond the likely lifespan of Earth
Future of the Earth
The biological and geological future of the Earth can be extrapolated based upon the estimated effects of several long-term influences. These include the chemistry at the Earth's surface, the rate of cooling of the planet's interior, the gravitational interactions with other objects in the Solar...

 or the Sun, and even past some predictions of the lifetime of the universe
Ultimate fate of the universe
The ultimate fate of the universe is a topic in physical cosmology. Many possible fates are predicted by rival scientific theories, including futures of both finite and infinite duration....

—that they are mainly referenced as matters of theoretical interest, jokes, or indications that a related problem truly is solved for any reasonable definition of "solved".
  • The year 292,277,026,296 (2.9*1011) and 584,554,051,223 (5.8*1011) problems: the years that 64-bit Unix time
    Unix time
    Unix time, or POSIX time, is a system for describing instants in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time of Thursday, January 1, 1970 , not counting leap seconds, which are declared by the International Earth Rotation and Reference Systems Service...

     becomes negative (assuming a signed number) or reset to zero (for an unsigned representation).

  • The year 5,391,559,471,918,239,497,011,222,876,596 (5.4*1030) and 10,783,118,943,836,478,994,022,445,751,223 (1.1*1031) problems: the years that 128-bit Unix time becomes negative (assuming a signed number) or reset to zero (for an unsigned representation).


Note: these year values are based on an average year being 365.2425 days, which matches the 4/100/400 leap year rules of the common Gregorian calendar
Gregorian calendar
The Gregorian calendar, also known as the Western calendar, or Christian calendar, is the internationally accepted civil calendar. It was introduced by Pope Gregory XIII, after whom the calendar was named, by a decree signed on 24 February 1582, a papal bull known by its opening words Inter...

. Additional adjustments to the calendar over intervals this long are unavoidable (ignoring that all of these times far exceed the likely existence of the Earth), so the year numbers should be considered approximate.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK