Epoch (computing)
In computing, an epoch is a date and time from which a computer measures system time. Most computer systems determine time as a number representing the seconds removed from particular arbitrary date and time. For instance, Unix and POSIX measure time as the number of seconds that have passed since 1 January 1970 00:00:00 UT, a point in time known as the Unix epoch. The NT time epoch on Windows NT and later refers to the Windows NT system time in (10^-7)s intervals from 0h 1 January 1601.[1]
Computing epochs are nearly always specified as midnight Universal Time on some particular date.
Variation in detail
Software timekeeping systems vary widely in the precision of time measurement (granularity); 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 nearly always convert this internal number into a date and time representing a human calendar.
Epoch 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.[2] 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".[3]
Problems with epoch-based computer time representation
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 which 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 which 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 if not fixed beforehand. This is known as the Year 2038 problem. A correction involving doubling the storage allocated to timekeeping on these systems will allow them to represent dates more than 290 billion years into the future.
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 which 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.[4] 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".[5]
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).
Epoch date | Notable uses | Rationale for selection |
---|---|---|
0 January 1 BC[nb 1] | MATLAB[6] | |
1 January AD 1[nb 1] | Microsoft .NET,[7][8] Go,[9] REXX,[10] Rata Die[11] | Common Era, ISO 2014,[12] RFC 3339[13] |
14 October 1582 | SPSS[14] | |
15 October 1582 | UUID version 1 | The date of the Gregorian reform to the Christian calendar.[15] |
1 January 1601 | NTFS, COBOL, Win32/Win64 (NT time epoch) | 1601 was the first year of the 400-year Gregorian calendar cycle at the time Windows NT was made.[16] |
31 December 1840 | MUMPS programming language | 1841 was a non-leap year several years before the birth year of the oldest living US citizen when the language was designed.[17] |
17 November 1858 | VMS, United States Naval Observatory, DVB SI 16-bit day stamps, other astronomy-related computations[18] | 17 November 1858, 00:00:00 UT is the zero of the Modified Julian Day (MJD) equivalent to Julian day 2400000.5[19] |
30 December 1899 | Microsoft COM DATE, Object Pascal, LibreOffice Calc, Google Sheets[20] | Technical internal value used by Microsoft Excel; for compatibility with Lotus 1-2-3.[4] |
31 December 1899 | Dyalog APL,[21] Microsoft C/C++ 7.0[22] | 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. |
0 January 1900 | Microsoft Excel,[4] Lotus 1-2-3[23] | 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. |
1 January 1900 | Network Time Protocol, IBM CICS, Mathematica, RISC OS, VME, Common Lisp, Michigan Terminal System | |
1 January 1904 | LabVIEW, Apple Inc.'s classic Mac OS, JMP Scripting Language, Palm OS, MP4, Microsoft Excel (optionally),[24] IGOR Pro | 1904 is the first leap year of the 20th century.[25] |
1 January 1960 | SAS System[26] | |
31 December 1967 | Pick OS and variants (jBASE, Universe, Unidata, Revelation, Reality) | Chosen so that (date mod 7) would produce 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, and 6=Saturday.[27] |
1 January 1970 | Unix Epoch aka POSIX time, used by Unix and Unix-like systems (Linux, macOS), and programming languages: most C/C++ implementations,[28] Java, JavaScript, Perl, PHP, Python, Ruby, Tcl, ActionScript. Also used by Precision Time Protocol. | |
1 January 1978 | AmigaOS.[29][nb 2] The Commodore Amiga hardware systems were introduced between 1985 and 1994. Latest OS version 4.1 (December 2016). AROS, MorphOS. | |
1 January 1980 | IBM BIOS INT 1Ah, DOS, OS/2, FAT12, FAT16, FAT32, exFAT filesystems | The IBM PC with its BIOS as well as 86-DOS, MS-DOS and PC DOS with their FAT12 file system were developed and introduced between 1980 and 1981. |
6 January 1980 | Qualcomm BREW, GPS, ATSC 32-bit time stamps | GPS counts weeks (a week is defined to start on Sunday) and 6 January is the first Sunday of 1980.[30][31] |
1 January 2000 | AppleSingle, AppleDouble,[32] PostgreSQL,[33][nb 3] ZigBee UTCTime[34] | |
1 January 2001 | Apple's Cocoa framework | 2001 is the year of the release of Mac OS X 10.0 (but NSDate for Apple's EOF 1.0 was developed in 1994). |
See also
- System time
- Unix epoch
Notes
- Proleptic Gregorian calendar.
- 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.
References
- W32tm | Microsoft Docs
- Subirana, J. Sanz; Zornoza, J. M. Juan; Hernández-Pajares, M. (2011). "Time References in GNSS". gssc.esa.int/navipedia. European Space Agency.
- "GNSS Timescale Description Galileo" (PDF). United Nations Office for Outer Space Affairs. 2016. Section 5d.
- Spolsky, Joel. "Why are the Microsoft Office file formats so complicated? (And some workarounds)". Retrieved 2009-03-08.
- Dershowitz, Nachum; Reingold, Edward (2008). Calendrical Calculations (3 ed.). Cambridge University Press. pp. xxi, xxvi. ISBN 978-0-521-70238-6.
- "datenum", MathWorks, accessed 2015-07-07.
- "GregorianCalendar Class". MSDN. Remarks. Retrieved 2015-04-26.
- "DateTimeOffset Structure" (.NET Framework 4.5), MSDN, 2015.
- "Package time". golang.org. Retrieved 2015-04-26.
- "Date—z/OS TSO/E REXX Reference". IBM.com. IBM. 2014. SA32-0972-00.
- Dershowitz, Nachum; Reingold, Edward (2008). "The Gregorian calendar". Calendrical Calculations (3 ed.). Cambridge University Press. ISBN 978-0-521-70238-6.
- Cowlishaw, Mike Frederic (1990). The Rexx Language: A Practical Approach to Programming (2 ed.). Prentice Hall. pp. 93, 177. ISBN 0-13-780651-5.
- "Go 1 Release Notes—Major changes to the library—Time". golang.org. 2012-03-28. Retrieved 2015-04-26.
- "Date and Time Formats". IBM.com. IBM. Retrieved 2020-01-24.
- Leach, P.; Mealling, M.; Salz, R. (July 2005). "RFC 4122: Proposed Standard: A Universally Unique IDentifier (UUID) URN Namespace". tools.ietf.org. Internet Engineering Task Force.
- Chen, Raymond (2009-03-06). "Why is the Win32 epoch January 1, 1601?". The Old New Thing. MSDN Blogs.
- "What happened in 1841?". M Technology and MUMPS Language FAQ, Part 1/2. Archived from the original on 2015-08-28. Retrieved 2015-08-14.
- Winkler, Gernot M. R. "Modified Julian Date". U.S. Naval Observatory. Archived from the original on 2013-02-14. Retrieved 2015-01-29.
- "VMS base time origin". vms.tuwien.ac.at/info/humour. Technische Universität Wien. Archived from the original on 2007-06-06.
- "Introduction to the Google Sheets API". Google Developers.
- "International Day Number". help.dyalog.com. Retrieved 2018-11-27.
- "Time Management". msdn.microsoft.com.
- "What is story behind December 30, 1899 as base date?". social.msdn.microsoft.com.
- "Dates And Times In Excel". cpearson.com.
- "MacTech – The journal of Apple technology". mactech.com.
- "Introduction to Dates and Times in SAS" (PDF).
- Mark Pick, International Spectrum Conference April 2010.
- "time_t – C++ Reference". Retrieved 2015-04-06.
- Barthel, Olaf (September 1998). "File: the year 2000 problem and the Amiga". obligement.free.fr.
- Levine, Judah (2002-07-05). "Time and frequency distribution using satellites" (PDF). Reports on Progress in Physics. 65 (8) – via National Institute of Standards and Technology (NIST).
- "Time Systems and Dates – GPS Time". Department of Oceanography, NPS. Naval Postgraduate School, Oceanography Department. Archived from the original on 2019-01-02. Retrieved 2019-02-18.
- "AppleSingle/AppleDouble Formats for Foreign Files Developer's Note" (PDF). Archived from the original (PDF) on 2011-07-17. Retrieved 2007-10-23.
- "PostgreSQL 9.1.24 Documentation. Chapter 8: Data Types. 8.5. Date/Time Types". PostgreSQL.org.
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.
- "ZigBee Cluster Library Specification". Section 2.5.2.21 UTCTime.
External links
- Critical and Significant Dates (J. R. Stockton), an extensive list of dates that are problematic for various operating systems and computing devices.
- Potential problem dates for computers (pdf) A list of potential problem dates for computers and software from 2001 to 2100 (IET).