Date and time from which a computer measures system time
In computing, an epoch is a fixed date and time used as a reference from which a computer measures system time. Most computer systems determine time as a number representing the seconds removed from a particular arbitrary date and time. For instance, Unix and POSIX measure time as the number of seconds that have passed since Thursday 1 January 1970 00:00:00 UT, a point in time known as the Unix epoch. The C# programming language and Windows NT systems up to and including Windows 11 and Windows Server 2022 measure time as the number of 100-nanosecond intervals that have passed since 00:00:00 UTC on 1 January in the years AD 1 and AD 1601, respectively, making those points in time the epochs for those systems.[1][2]
Computing epochs are almost always specified as midnight Universal Time on some particular date.
Resolution and representation
Software timekeeping systems vary widely in the resolution of time measurement; some systems may use time units as large as a day, while others may use nanoseconds. For example, for an epoch date of midnight UTC (00:00) on 1 January 1900, and a time unit of a second, the time of the midnight (24:00) between 1 January 1900 and 2 January 1900 is represented by the number 86400, the number of seconds in one day. When times prior to the epoch need to be represented, it is common to use the same system, but with negative numbers.
Such representation of time is mainly for internal use. On systems where date and time are important in the human sense, software will almost always convert this internal number into a date and time representing a human calendar.
Problems
Computers do not generally store arbitrarily large numbers. Instead, each number stored by a computer is allotted a fixed amount of space. Therefore, when the number of time units that have elapsed since a system's epoch exceeds the largest number that can fit in the space allotted to the time representation, the time representation overflows, and problems can occur. While a system's behavior after overflow occurs is not necessarily predictable, in most systems the number representing the time will reset to zero, and the computer system will think that the current time is the epoch time again.
Most famously, older systems that counted time as the number of years elapsed since the epoch of 1 January 1900 and which only allotted enough space to store the numbers 0 through 99, experienced the Year 2000 problem. These systems (if not corrected beforehand) would interpret the date 1 January 2000 as 1 January 1900, leading to unpredictable errors at the beginning of the year 2000.
Even systems that allocate more storage to the time representation are not immune from this kind of error. Many Unix-like operating systems which keep time as seconds elapsed from the epoch date of 1 January 1970, and allot timekeeping enough storage to store numbers as large as 2 147 483 647 will experience an overflow problem on 19 January 2038. This is known as the Year 2038 problem.
Other more subtle timekeeping problems exist in computing, such as accounting for leap seconds, which are not observed with any predictability or regularity. Additionally, applications that need to represent historical dates and times (for example, representing a date prior to the switch from the Julian calendar to the Gregorian calendar) must use specialized timekeeping libraries.
Finally, some software must maintain compatibility with older software that does not keep time in strict accordance with traditional timekeeping systems. For example, Microsoft Excel observes the fictional date of 29 February 1900 in order to maintain bug compatibility with older versions of Lotus 1-2-3.[3] Lotus 1-2-3 observed the date due to an error; by the time the error was discovered, it was too late to fix it—"a change now would disrupt formulas which were written to accommodate this anomaly".[4]
In satellite-based time systems
There are at least six satellite navigation systems, all of which function by transmitting time signals. Of the only two satellite systems with global coverage, GPS calculates its time signal from an epoch, whereas GLONASS calculates time as an offset from UTC, with the UTC input adjusted for leap seconds. Of the only two other systems aiming for global coverage, Galileo calculates from an epoch and BeiDou calculates from UTC without adjustment for leap seconds.[5][needs update?] GPS also transmits the offset between UTC time and GPS time and must update this offset every time there is a leap second, requiring GPS-receiving devices to handle the update correctly. In contrast, leap seconds are transparent to GLONASS users.
The complexities of calculating UTC from an epoch are explained by the European Space Agency in Galileo documentation under "Equations to correct system timescale to reference timescale".[6]
Notable epoch dates in computing
The following table lists epoch dates used by popular software and other computer-related systems. The time in these systems is stored as the quantity of a particular time unit (days, seconds, nanoseconds, etc.) that has elapsed since a stated time (usually midnight UTC at the beginning of the given date).
Chosen so that (date mod 7) would produce 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, and 6=Saturday. Microsoft’s last version of non-Visual C/C++ used this, but was subsequently reverted.
While logically 0 January 1900 is equivalent to 31 December 1899, these systems do not allow users to specify the latter date. Since 1900 is incorrectly treated as a leap year in these systems, 0 January 1900 actually corresponds to the historical date of 30 December 1899.
In the first version of the language, dates were limited to the range 1901 to 2099 to avoid years affected by the 400 year leap year rule. When the upper bound was expanded in later versions, the lower bound was left the same to maintain backward compatibility with systems that used it as a datum.[28]
GPS counts weeks (a week is defined to start on Sunday) and 6 January is the first Sunday of 1980.[35][36] Weeks are stored in a 10-bit integer, and the first GPS week number rollover occurred in August 1999.
31 December 1989
Garmin FIT Epoch.[37] Standard originated by Garmin as part of their FIT Protocol, which has been adopted by many as a de facto standard in the fitness devices industry.[38]
^AmigaOS measures time in seconds and stores it in a signed 32 bit integer. After 19 January 2046, 03:14:07 the date will be negative. Latest OS version 4.1 (2016) has no fix for this.
^Be aware that the Epoch function return the unix Epoch SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '1970-01-01 00:00:00-00'); returns 0.
^"PostgreSQL 9.1.24 Documentation. Chapter 8: Data Types. 8.5. Date/Time Types". PostgreSQL.org. 2016-10-27. Note: When timestamp values are stored as eight-byte integers (currently the default), microsecond precision is available over the full range of values. […] timestamp values are stored as seconds before or after midnight 2000-01-01.