Unix time
Encyclopedia
Unix time, or POSIX time, is a system for describing instants in time
Time
Time is a part of the measuring system used to sequence events, to compare the durations of events and the intervals between them, and to quantify rates of change such as the motions of objects....

, defined as the number of second
Second
The second is a unit of measurement of time, and is the International System of Units base unit of time. It may be measured using a clock....

s elapsed since midnight
Midnight
Midnight is the transition time period from one day to the next: the moment when the date changes. In the Roman time system, midnight was halfway between sunset and sunrise, varying according to the seasons....

 Coordinated Universal Time
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...

 (UTC) of Thursday
Thursday
Thursday is the fourth day of the week according to the ISO 8601 international standard adopted in most western countries. In countries that use the Sunday-first convention and in the Judeo-Christian calendar it is the fifth day of the week. It falls between Wednesday and Friday...

, January 1, 1970 (Unix times are defined, but negative, before that date), not counting 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, which are declared by the International Earth Rotation and Reference Systems Service
International Earth Rotation and Reference Systems Service
The International Earth Rotation and Reference Systems Service , formerly the International Earth Rotation Service, is the body responsible for maintaining global time and reference frame standards, notably through its Earth Orientation Parameter and International Celestial Reference System ...

 and are not predictable. It is used widely in 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....

 and many other operating systems and file format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...

s. It is neither a linear representation of time nor a true representation of UTC (though it is frequently mistaken for both), as it cannot unambiguously represent UTC leap seconds (e.g. December 31, 1998 23:59:60), although otherwise the times it represents are UTC. Unix time may be checked on some Unix systems by typing date +%s on the command line.
Example: (Z
ISO 8601
ISO 8601 Data elements and interchange formats – Information interchange – Representation of dates and times is an international standard covering the exchange of date and time-related data. It was issued by the International Organization for Standardization and was first published in 1988...

)
(Above, the Unix time when this page was last generated)

Definition

Two layers of encoding make up Unix time. These can usefully be separated. The first layer encodes a point in time as a scalar real number, and the second encodes that number as a sequence of bits or in another form.

Encoding time as a number

Unix time is a single signed integer
Integer
The integers are formed by the natural numbers together with the negatives of the non-zero natural numbers .They are known as Positive and Negative Integers respectively...

 number which increments every second, without requiring the calculations to determine year, month, day of month, hour and minute required for intelligibility to humans.
Modern 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...

 time is based strictly on UTC, which counts time using SI
Si
Si, si, or SI may refer to :- Measurement, mathematics and science :* International System of Units , the modern international standard version of the metric system...

 seconds, and breaks up the span of time into days almost always 86 400 s long, but due to leap seconds occasionally 86 401 s and could be 86 399 s long (though the latter option had never been used ); this keeps the days synchronized with the rotation of the Earth (or Universal Time
Universal Time
Universal Time is a time scale based on the rotation of the Earth. It is a modern continuation of Greenwich Mean Time , i.e., the mean solar time on the Prime Meridian at Greenwich, and GMT is sometimes used loosely as a synonym for UTC...

). As is standard with UTC, this article labels days using the 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...

, and counts times within each day in hours, minutes, and seconds. Some of the examples also show 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...

, another time scheme, which uses the same seconds and is displayed in the same format as UTC, but in which every day is exactly 86 400 s long, gradually losing synchronization with the Earth's rotation at a rate of roughly one second per year.

The Unix 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...

is the time 00:00:00 UTC on 1 January 1970 (or 1970-01-01T00:00:00Z ISO 8601). There is a problem with this definition, in that UTC did not exist in its current form until 1972; this issue is discussed below. For brevity, the remainder of this section uses ISO 8601
ISO 8601
ISO 8601 Data elements and interchange formats – Information interchange – Representation of dates and times is an international standard covering the exchange of date and time-related data. It was issued by the International Organization for Standardization and was first published in 1988...

 date format, in which the Unix epoch is 1970-01-01T00:00:00Z.

The Unix time number is zero at the Unix epoch, and increases by exactly 86 400 per day since the epoch. Thus 2004-09-16T00:00:00Z, 12 677 days after the epoch, is represented by the Unix time number 12 677 × 86 400 = 1 095 292 800. This can be extended backwards from the epoch too, using negative numbers; thus 1957-10-04T00:00:00Z, 4 472 days before the epoch, is represented by the Unix time number -4 472 × 86 400 = -386 380 800.

Within each day, the Unix time number is as calculated in the preceding paragraph at midnight UTC (00:00:00Z), and increases by exactly 1 per second since midnight. Thus 2004-09-16T17:55:43.54Z, 64 543.54 s since midnight on the day in the example above, is represented by the Unix time number 1 095 292 800 + 64 543.54 = 1 095 357 343.54. On dates before the epoch the number still increases, thus becoming less negative, as time moves forward.

The above scheme means that on a normal UTC day, of duration 86 400 s, the Unix time number changes in a continuous
Continuous function
In mathematics, a continuous function is a function for which, intuitively, "small" changes in the input result in "small" changes in the output. Otherwise, a function is said to be "discontinuous". A continuous function with a continuous inverse function is called "bicontinuous".Continuity of...

 manner across midnight. For example, at the end of the day used in the examples above, the time representations progress like this:
Unix time across midnight on a normal UTC day
TAI UTC Unix time
2004-09-17T00:00:30.75 2004-09-16T23:59:58.75 1 095 379 198.75
2004-09-17T00:00:31.00 2004-09-16T23:59:59.00 1 095 379 199.00
2004-09-17T00:00:31.25 2004-09-16T23:59:59.25 1 095 379 199.25
2004-09-17T00:00:31.50 2004-09-16T23:59:59.50 1 095 379 199.50
2004-09-17T00:00:31.75 2004-09-16T23:59:59.75 1 095 379 199.75
2004-09-17T00:00:32.00 2004-09-17T00:00:00.00 1 095 379 200.00
2004-09-17T00:00:32.25 2004-09-17T00:00:00.25 1 095 379 200.25
2004-09-17T00:00:32.50 2004-09-17T00:00:00.50 1 095 379 200.50
2004-09-17T00:00:32.75 2004-09-17T00:00:00.75 1 095 379 200.75
2004-09-17T00:00:33.00 2004-09-17T00:00:01.00 1 095 379 201.00
2004-09-17T00:00:33.25 2004-09-17T00:00:01.25 1 095 379 201.25


When a leap second occurs, so that the UTC day is not exactly 86 400 s long, a discontinuity occurs in the Unix time number. The Unix time number increases by exactly 86 400 each day, regardless of how long the day is. When a leap second is deleted (which has never occurred ), the Unix time number jumps up by 1 where the leap second was deleted, which is the end of the day. When a leap second is inserted (which has occurred on average once every year and a half), the Unix time number increases continuously during the leap second, during which time it is more than 86 400 s since the start of the current day, and then jumps down by 1 at the end of the leap second, which is the start of the next day. For example, this is what happened on strictly conforming POSIX.1 systems at the end of 1998:
Unix time across midnight when a UTC leap second is inserted
TAI UTC Unix time
1999-01-01T00:00:29.75 1998-12-31T23:59:58.75 915 148 798.75
1999-01-01T00:00:30.00 1998-12-31T23:59:59.00 915 148 799.00
1999-01-01T00:00:30.25 1998-12-31T23:59:59.25 915 148 799.25
1999-01-01T00:00:30.50 1998-12-31T23:59:59.50 915 148 799.50
1999-01-01T00:00:30.75 1998-12-31T23:59:59.75 915 148 799.75
1999-01-01T00:00:31.00 1998-12-31T23:59:60.00 915 148 800.00
1999-01-01T00:00:31.25 1998-12-31T23:59:60.25 915 148 800.25
1999-01-01T00:00:31.50 1998-12-31T23:59:60.50 915 148 800.50
1999-01-01T00:00:31.75 1998-12-31T23:59:60.75 915 148 800.75
1999-01-01T00:00:32.00 1999-01-01T00:00:00.00 915 148 800.00
1999-01-01T00:00:32.25 1999-01-01T00:00:00.25 915 148 800.25
1999-01-01T00:00:32.50 1999-01-01T00:00:00.50 915 148 800.50
1999-01-01T00:00:32.75 1999-01-01T00:00:00.75 915 148 800.75
1999-01-01T00:00:33.00 1999-01-01T00:00:01.00 915 148 801.00
1999-01-01T00:00:33.25 1999-01-01T00:00:01.25 915 148 801.25


Observe that when a positive leap second occurs (i.e., when a leap second is inserted) the Unix time numbers repeat themselves. The Unix time number 915 148 800.50 is ambiguous: it can refer either to the instant in the middle of the leap second, or to the instant one second later, half a second after midnight UTC. In the theoretical case when a negative leap second occurs (i.e., when a leap second is deleted) no ambiguity is caused, but instead there is a range of Unix time numbers that do not refer to any point in time at all.

A Unix clock is often implemented with a different type of positive leap second handling associated with the Network Time Protocol
Network Time Protocol
The Network Time Protocol is a protocol and software implementation for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks. Originally designed by David L...

 (NTP). This yields a system that does not conform to the POSIX standard. See the section below concerning NTP for details.

When dealing with periods that do not encompass a UTC leap second, the difference between two Unix time numbers is equal to the duration in seconds of the period between the corresponding points in time. This is a common computational technique. However, where leap seconds occur, such calculations give the wrong answer. In applications where this level of accuracy is required, it is necessary to consult a table of leap seconds when dealing with Unix times, and it is often preferable to use a different time encoding that does not suffer this problem.

A Unix time number is easily converted back into UTC by taking the quotient and modulus of the Unix time number, modulo 86 400. The quotient is the number of days since the epoch, and the modulus is the number of seconds since midnight UTC on that day. (It is important to ensure that the right type of modulus is being calculated when dealing with times before the epoch.) If given a Unix time number that is ambiguous due to a positive leap second, this algorithm interprets it as the time just after midnight. It never generates a time that is during a leap second. If given a Unix time number that is invalid due to a negative leap second, it generates an equally invalid UTC time. If these conditions are significant, it is necessary to consult a table of leap seconds to detect them.

There are numerous online utilities available to convert between a date and a Unix timestamp.

Non-synchronous Network Time Protocol-based variant

Commonly a Mills
David L. Mills
David L. Mills is an American computer engineer and Internet pioneer. Mills earned his PhD in Computer and Communication Sciences from the University of Michigan in 1971...

-style Unix clock is implemented with leap second handling not synchronous with the change of the Unix time number. The time number initially decreases where a leap should have occurred, and then it leaps to the correct time 1 second after the leap. This makes implementation easier, and is suggested in passing by Mills's paper. This is what happens across a positive leap second:
non-synchronous Mills-style Unix clock across midnight when a UTC leap second is inserted
TAI UTC state Unix clock
1999-01-01T00:00:29.75 1998-12-31T23:59:58.75 TIME_INS 915 148 798.75
1999-01-01T00:00:30.00 1998-12-31T23:59:59.00 TIME_INS 915 148 799.00
1999-01-01T00:00:30.25 1998-12-31T23:59:59.25 TIME_INS 915 148 799.25
1999-01-01T00:00:30.50 1998-12-31T23:59:59.50 TIME_INS 915 148 799.50
1999-01-01T00:00:30.75 1998-12-31T23:59:59.75 TIME_INS 915 148 799.75
1999-01-01T00:00:31.00 1998-12-31T23:59:60.00 TIME_INS 915 148 800.00
1999-01-01T00:00:31.25 1998-12-31T23:59:60.25 TIME_OOP 915 148 799.25
1999-01-01T00:00:31.50 1998-12-31T23:59:60.50 TIME_OOP 915 148 799.50
1999-01-01T00:00:31.75 1998-12-31T23:59:60.75 TIME_OOP 915 148 799.75
1999-01-01T00:00:32.00 1999-01-01T00:00:00.00 TIME_OOP 915 148 800.00
1999-01-01T00:00:32.25 1999-01-01T00:00:00.25 TIME_WAIT 915 148 800.25
1999-01-01T00:00:32.50 1999-01-01T00:00:00.50 TIME_WAIT 915 148 800.50
1999-01-01T00:00:32.75 1999-01-01T00:00:00.75 TIME_WAIT 915 148 800.75
1999-01-01T00:00:33.00 1999-01-01T00:00:01.00 TIME_WAIT 915 148 801.00
1999-01-01T00:00:33.25 1999-01-01T00:00:01.25 TIME_WAIT 915 148 801.25


This can be decoded properly by paying attention to the leap second state variable, which unambiguously indicates whether the leap has been performed yet. The state variable change is synchronous with the leap.

A similar situation arises with a negative leap second, where the second that is skipped is slightly too late. Very briefly the system shows a nominally impossible time number, but this can be detected by the TIME_DEL state and corrected.

In this type of system the Unix time number violates POSIX around both types of leap second. Collecting the leap second state variable along with the time number allows for unambiguous decoding, so the correct POSIX time number can be generated if desired, or the full UTC time can be stored in a more suitable format.

The decoding logic required to cope with this style of Unix clock would also correctly decode a hypothetical POSIX-conforming clock using the same interface. This would be achieved by indicating the TIME_INS state during the entirety of an inserted leap second, then indicating TIME_WAIT during the entirety of the following second while repeating the seconds count. This requires synchronous leap second handling. This is probably the best way to express UTC time in Unix clock form, via a Unix interface, when the underlying clock is fundamentally untroubled by leap seconds.

International Atomic Time-based variant

Another, much rarer, non-conforming variant of Unix time keeping involves encoding TAI rather than UTC. Because TAI has no leap seconds, and every TAI day is exactly 86 400 s long, this encoding is actually a pure linear count of seconds elapsed since 1970-01-01T00:00:00 TAI. This makes time interval arithmetic much easier. Time values from these systems do not suffer the ambiguity that strictly conforming POSIX systems or NTP-driven systems have.

In these systems it is necessary to consult a table of leap seconds to correctly convert between UTC and the pseudo-Unix-time representation. This resembles the manner in which time zone tables must be consulted to convert to and from civil time
Civil time
In modern usage, civil time refers to statutory time scales designated by civilian authorities, or to local time indicated by clocks. Modern civil time is generally standard time in a time zone at a fixed offset from Coordinated Universal Time or from Greenwich Mean Time , possibly adjusted by...

; the tz database includes leap second information, and the sample code available from the same source uses that information to convert between TAI-based time stamps and local time. The leap second table must be updated (from the published leap second bulletins) more frequently than the time zone tables, because leap seconds occur at shorter notice than changes to daylight saving time
Daylight saving time
Daylight saving time —also summer time in several countries including in British English and European official terminology —is the practice of temporarily advancing clocks during the summertime so that afternoons have more daylight and mornings have less...

 rules. (A standard Unix time system must similarly consult a leap second table to convert to and from TAI, but this is a much rarer requirement.) Conversion also runs into definitional problems prior to the 1972 commencement of the current form of UTC (see the later section about UTC).

This TAI-based system, despite its superficial resemblance, is not Unix time. It encodes times with significantly different values from the POSIX time values, and does not have the simple mathematical relationship to UTC that is mandated by POSIX.

Representing the number

A Unix time number can be represented in any form capable of representing numbers. In some applications the number is simply represented textually as a string of decimal digits, raising only trivial additional issues. However, certain binary representations of Unix times are particularly significant.

The standard Unix time t (data type representing a point in time) is a 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....

 data type, traditionally of 32 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...

s (but see below), directly encoding the Unix time number as described in the preceding section. Being 32 bits means that it covers a range of about 136 years in total. The minimum representable time is 1901-12-13, and the maximum representable time is 2038-01-19. At 03:14:07 UTC 2038-01-19 this representation 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...

s. This milestone is anticipated with a mixture of amusement and dread; see year 2038 problem
Year 2038 problem
The year 2038 problem may cause some computer software to fail at some point near the year 2038...

.

In some newer operating systems, time_t has been widened to 64 bits. In the negative direction, this goes back more than twenty times the age of the universe
Age of the universe
The age of the universe is the time elapsed since the Big Bang posited by the most widely accepted scientific model of cosmology. The best current estimate of the age of the universe is 13.75 ± 0.13 billion years within the Lambda-CDM concordance model...

, and so suffices. In the positive direction, whether the approximately 293 billion representable years is truly sufficient depends on the ultimate fate 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....

, but it is certainly adequate for most practical purposes.

There was originally some controversy over whether the Unix time_t should be signed or unsigned. If unsigned, its range in the future would be doubled, postponing the 32-bit overflow (by 68 years). However, it would then be incapable of representing times prior to 1970. Dennis Ritchie
Dennis Ritchie
Dennis MacAlistair Ritchie , was an American computer scientist who "helped shape the digital era." He created the C programming language and, with long-time colleague Ken Thompson, the UNIX operating system...

, when asked about this issue, said that he hadn't thought very deeply about it, but was of the opinion that the ability to represent all times within his lifetime would be nice. (Ritchie's birth, in 1941, is around Unix time −893 400 000.) The consensus is for time_t to be signed, and this is the usual practice. The software development platform for version 6 of the QNX
QNX
QNX is a commercial Unix-like real-time operating system, aimed primarily at the embedded systems market. The product was originally developed by Canadian company, QNX Software Systems, which was later acquired by Canadian BlackBerry-producer Research In Motion.-Description:As a microkernel-based...

 operating system has an unsigned 32-bit time_t, though older releases used a signed type.

The POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 and Open Group Unix specifications include the ISO C standard library
C standard library
The C Standard Library is the standard library for the programming language C, as specified in the ANSI C standard.. It was developed at the same time as the C POSIX library, which is basically a superset of it...

, which includes the time types and functions defined in the <time.h>
Time.h
C date and time functions refer to a group of functions in the standard library of the C programming language implementing date and time manipulation operations...

 header file. The ISO C standard states that time_t must be an arithmetic type, but does not mandate any specific type or encoding for it.

Unix has no tradition of directly representing non-integer Unix time numbers as binary fractions. Instead, times with sub-second precision are represented using compound data type
Composite type
In computer science, a composite data type is any data type which can be constructed in a program using its programming language's primitive data types and other composite types...

s that consist of two integers, the first being a time_t (the integral part of the Unix time), and the second being the fractional part of the time number in millionths (in struct timeval) or billionths (in struct timespec). These structures provide a decimal
Decimal
The decimal numeral system has ten as its base. It is the numerical base most widely used by modern civilizations....

-based fixed-point
Fixed-point arithmetic
In computing, a fixed-point number representation is a real data type for a number that has a fixed number of digits after the radix point...

 data format, which is useful for some applications, and trivial to convert for others.

UTC basis

The present form of UTC, with leap seconds, is defined only from January 1, 1972 onwards. Prior to that, since January 1, 1961 there was an older form of UTC in which not only were there occasional time steps, which were by non-integer numbers of seconds, but also the UTC second was slightly longer than the SI second, and periodically changed to continuously approximate the Earth's rotation. Prior to 1961 there was no UTC, and prior to 1958 there was no widespread atomic timekeeping
Atomic clock
An atomic clock is a clock that uses an electronic transition frequency in the microwave, optical, or ultraviolet region of the electromagnetic spectrum of atoms as a frequency standard for its timekeeping element...

; in these eras, some approximation of GMT (based directly on the Earth's rotation) was used instead of an atomic timescale.

The precise definition of Unix time as an encoding of UTC is only uncontroversial when applied to the present form of UTC. Fortunately, the fact that the Unix epoch predates the start of this form of UTC does not affect its use in this era: the number of days from January 1, 1970 (the Unix epoch) to January 1, 1972 (the start of UTC) is not in question, and the number of days is all that is significant to Unix time.

The meaning of Unix time values below +63 072 000 (i.e., prior to 1 January 1972) is not precisely defined. The basis of such Unix times is best understood to be an unspecified approximation of GMT. Computers of that era rarely had clocks set sufficiently accurately to provide meaningful sub-second timestamps in any case. Unix time is not a suitable way to represent times prior to 1972 in applications requiring sub-second precision; such applications must, at least, define which form of UT or GMT they use.

, the possibility of ending the use of leap seconds in civil time is being considered. A likely means to execute this change is to define a new time scale, called "International Time", that initially matches UTC but thereafter has no leap seconds, thus remaining at a constant offset from TAI. If this happens, it is likely that Unix time will be prospectively defined in terms of this new time scale, instead of UTC. Uncertainty about whether this will occur makes prospective Unix time no less predictable than it already is: if UTC were simply to have no further leap seconds the result would be the same. Reinterpreting Unix time in terms of TAI or GPS time, while simpler in theory, would make a hash of assumptions built into time-handling code written since the 1970s. Such a move would be a replacement of Unix time by a new system, rather than a reinterpretation.

History

The earliest versions of Unix time had a 32-bit integer incrementing at a rate of 60 Hz
Hertz
The hertz is the SI unit of frequency defined as the number of cycles per second of a periodic phenomenon. One of its most common uses is the description of the sine wave, particularly those used in radio and audio applications....

, which was the rate of the system clock on the hardware of the early Unix systems. The value 60 Hz still appears in some software interfaces as a result. The epoch also differed from the current value. The first edition Unix Programmer's Manual dated 3 November 1971 defines the Unix time as "the time since 00:00:00, Jan. 1, 1971, measured in sixtieths of a second".

The User Manual also commented that "the chronologically-minded user will note that 232 sixtieths of a second is only about 2.5 years". Because of this limited range, the epoch was redefined more than once, before the rate was changed to 1 Hz and the epoch was set to its present value. This yielded a range in excess of 130 years, though with more than half the range in the past (see discussion of signedness above).

As indicated by the definition quoted above, the Unix time scale was originally intended to be a simple linear representation of time elapsed since an epoch. However, there was no consideration of the details of time scales, and it was implicitly assumed that there was a simple linear time scale already available and agreed upon. Indeed, the first edition manual's definition doesn't even specify which timezone is used. Several later problems, including the complexity of the present definition, result from Unix time having been defined gradually by usage rather than fully defined to start with.

When POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

.1 was written (it was published in 1988), the question arose of how to precisely define time_t in the face of leap seconds. Some argued for it to remain, as intended, a linear count of seconds since the epoch, at the expense of complexity in conversions with civil time. Others argued for it to remain, as conflictingly intended, easily interconvertible with the conventional representation of civil time, at the expense of inconsistency around leap seconds. Computer clocks of the era were not sufficiently precisely set to form a precedent one way or the other.

The POSIX committee was swayed by arguments against complexity in the library functions, and firmly defined the Unix time in a simple manner in terms of the elements of UTC time. Unfortunately, this definition was so simple that it didn't even encompass the entire leap year
Leap year
A leap year is a year containing one extra day in order to keep the calendar year synchronized with the astronomical or seasonal year...

 rule of the Gregorian calendar, and would make 2100 a leap year.

The 2001 edition of POSIX.1 rectified the faulty leap year rule in the definition of Unix time, but retained the essential definition of Unix time as an encoding of UTC rather than a linear time scale. Also, since the mid-1990s computer clocks have been routinely set with sufficient precision for this to matter, and they have most commonly been set using the UTC-based definition of Unix time. This has resulted in considerable complexity in Unix implementations, and in the Network Time Protocol
Network Time Protocol
The Network Time Protocol is a protocol and software implementation for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks. Originally designed by David L...

, to execute steps in the Unix time number whenever leap seconds occur.

Notable events in Unix time

Unix enthusiasts have a history of holding time_t parties to celebrate significant values of the Unix time number. These are directly analogous to the new year
New Year
The New Year is the day that marks the time of the beginning of a new calendar year, and is the day on which the year count of the specific calendar used is incremented. For many cultures, the event is celebrated in some manner....

 celebrations that occur at the change of year in many calendars. As the use of Unix time has spread, so has the practice of celebrating its milestones. Usually it is time values that are round numbers in decimal
Decimal
The decimal numeral system has ten as its base. It is the numerical base most widely used by modern civilizations....

 that are celebrated, following the Unix convention of viewing time_t values in decimal. Among some groups round binary
Binary numeral system
The binary numeral system, or base-2 number system, represents numeric values using two symbols, 0 and 1. More specifically, the usual base-2 system is a positional notation with a radix of 2...

 numbers are also celebrated, such as +230 which occurred at 13:37:04 UTC on January 10, 2004.

The events that these celebrate are typically described as "N seconds since the Unix epoch", but this is inaccurate. As discussed above, due to the handling of leap seconds in Unix time, the number of seconds elapsed since the Unix epoch is slightly greater than the Unix time number for times later than the epoch.
  • At 01:46:40 UTC on 09 Sep 2001, the Unix billennium
    Unix billennium
    The Unix billennium is the point in time represented by a Unix time value of 109: 01:46:40 UTC on September 9, 2001. Some programs which stored timestamps using a text representation encountered sorting errors, as in a text sort times after the turnover, starting with a "1" digit, erroneously...

     (Unix time number 1,000,000,000) was celebrated.
  • At 13:37:04 UTC on 10 Jan 2004, the Unix time number reached 230, exactly halfway between the Unix epoch and the year 2038 problem
    Year 2038 problem
    The year 2038 problem may cause some computer software to fail at some point near the year 2038...

    . It is unknown whether this date was celebrated.
  • At 01:58:31 UTC on 18 Mar 2005, the Unix time number reached 1,111,111,111. At 23:31:30 UTC on 13 Feb 2009, at exactly 23:31:30 (UTC) the decimal
    Decimal
    The decimal numeral system has ten as its base. It is the numerical base most widely used by modern civilizations....

     representation of 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...

     time reached 1,234,567,890 seconds. In some parts of the world, this day fell on Friday the 13th
    Friday the 13th
    Friday the 13th occurs when the thirteenth day of a month falls on a Friday, which superstition holds to be a day of bad luck. In the Gregorian calendar, this day occurs at least once, but at most three times a year...

     in the 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...

    . (February 14 for locations from France east to the International Date Line
    International Date Line
    The International Date Line is a generally north-south imaginary line on the surface of the Earth, passing through the middle of the Pacific Ocean, that designates the place where each calendar day begins...

    .) Google
    Google
    Google Inc. is an American multinational public corporation invested in Internet search, cloud computing, and advertising technologies. Google hosts and develops a number of Internet-based services and products, and generates profit primarily from advertising through its AdWords program...

     celebrated this with a Google doodle. Parties and other celebrations were held around the world, among various technical subcultures, to celebrate the 1234567890 day.
  • At 03:42:01 UTC on 27 Jul 2011, the Unix time number reached the 25th Pell number
    Pell number
    In mathematics, the Pell numbers are an infinite sequence of integers that have been known since ancient times, the denominators of the closest rational approximations to the square root of 2. This sequence of approximations begins 1/1, 3/2, 7/5, 17/12, and 41/29, so the sequence of Pell numbers...

     (1,311,738,121 seconds).
  • At 11:01:20 UTC on 13 Jul 2012, the Unix time number will reach 0x50000000
    Hexadecimal
    In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...

     (1,342,177,280 seconds). With the exception of locations in time zones UTC−12:00, UTC+13:00, and UTC+14:00, this also happens on a Friday the 13th.
  • At 11:09:05 UTC on 28 Oct 2013, the Unix time number will reach the 15th Bell number
    Bell number
    In combinatorics, the nth Bell number, named after Eric Temple Bell, is the number of partitions of a set with n members, or equivalently, the number of equivalence relations on it...

     (1,382,958,545 seconds).
  • At 05:06:02 UTC on 25 Oct 2014, the Unix time number will reach 1414213562 representing the first 10 digits of the square root of 2
    Square root of 2
    The square root of 2, often known as root 2, is the positive algebraic number that, when multiplied by itself, gives the number 2. It is more precisely called the principal square root of 2, to distinguish it from the negative number with the same property.Geometrically the square root of 2 is the...

    .
  • At 02:53:08 UTC on 04 Oct 2021, the Unix time number will reach 1618033988 representing the first 10 digits of the golden ratio
    Golden ratio
    In mathematics and the arts, two quantities are in the golden ratio if the ratio of the sum of the quantities to the larger quantity is equal to the ratio of the larger quantity to the smaller one. The golden ratio is an irrational mathematical constant, approximately 1.61803398874989...

     phi.
  • At 03:33:20 UTC on 18 May 2033, the Unix time reaches 2,000,000,000 seconds, the second billennium.
  • At 09:06:49 UTC on 16 Jun 2034, the Unix time reaches 2,034,061,609 seconds and thus matches the current time to the hour (2034061609) when displayed as YYYYMMDDHH.
  • At 03:14:08 UTC on 19 Jan 2038, 32-bit versions of the Unix time stamp will cease to work
    Year 2038 problem
    The year 2038 problem may cause some computer software to fail at some point near the year 2038...

    , as it will overflow the largest value that can be held in a signed 32-bit number. Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems.
  • At 14:17:04 UTC on 20 Feb 2056, the Unix time will represent the first 10 digits of e
    E (mathematical constant)
    The mathematical constant ' is the unique real number such that the value of the derivative of the function at the point is equal to 1. The function so defined is called the exponential function, and its inverse is the natural logarithm, or logarithm to base...

    , 2718281824.
  • At 00:37:33 UTC on 21 Jul 2069, the Unix time will represent the first 10 digits of pi
    Pi
    ' is a mathematical constant that is the ratio of any circle's circumference to its diameter. is approximately equal to 3.14. Many formulae in mathematics, science, and engineering involve , which makes it one of the most important mathematical constants...

    , 3141592653. (This coincides with the 100th anniversary of the first manned Moon landing
    Apollo 11
    In early 1969, Bill Anders accepted a job with the National Space Council effective in August 1969 and announced his retirement as an astronaut. At that point Ken Mattingly was moved from the support crew into parallel training with Anders as backup Command Module Pilot in case Apollo 11 was...

    , occurring between the times of touchdown and the first moon walk.)
  • At 17:26:22 UTC on Thu, 02 Dec 2077, the Unix time reaches 3,405,691,582 seconds (hexadecimal CAFEBABE
    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...

    ); used as a placeholder in programming.
  • At 18:57:17 UTC on Thu, 02 Dec 2077, the Unix time reaches 3,405,697,037 seconds (hexadecimal CAFED00D); used as a placeholder in programming.
  • At 06:28:15 UTC on Sun, 07 Feb 2106, the Unix time reaches 0xFFFFFFFF or 4,294,967,295 seconds which, for systems that hold the time on 32 bit unsigned numbers, is the maximum attainable. For these systems, the next second will incorrectly be Thursday January 1st 1970 at 0:00:00.
  • At 00:00:00 UTC on Thu, 30 Apr 2167, the Unix time reaches the factorial
    Factorial
    In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n...

     13! (6,227,020,800 seconds).
  • At 17:46:40 UTC on Sat, 20 Nov 2286, the Unix time reaches 10,000,000,000 seconds.
  • At 15:30:08 UTC on Sun, 04 December 292,277,026,596, 64-bit versions of the Unix time stamp will cease to work, as it will overflow the largest value that can be held in a signed 64-bit number.

In literature

Vernor Vinge
Vernor Vinge
Vernor Steffen Vinge is a retired San Diego State University Professor of Mathematics, computer scientist, and science fiction author. He is best known for his Hugo Award-winning novels and novellas A Fire Upon the Deep , A Deepness in the Sky , Rainbows End , Fast Times at Fairmont High ...

's novel A Deepness in the Sky
A Deepness in the Sky
A Deepness in the Sky is a Hugo Award–winning science fiction novel by Vernor Vinge. Published in 1999, the novel is a loose prequel to his earlier novel A Fire Upon the Deep...

describes a space-faring trading civilization tens of thousands of years (hundreds of gigaseconds) in the future that apparently still uses the Unix epoch, despite the apparent problems that would have arisen with older Unix systems following the Year 2038 problem
Year 2038 problem
The year 2038 problem may cause some computer software to fail at some point near the year 2038...

. The 'programming archaeologist' responsible for maintenance of old computer systems first believes that the epoch refers to the time when man first walked on the moon
Apollo 11
In early 1969, Bill Anders accepted a job with the National Space Council effective in August 1969 and announced his retirement as an astronaut. At that point Ken Mattingly was moved from the support crew into parallel training with Anders as backup Command Module Pilot in case Apollo 11 was...

, but then realises that it is "the 0-second of one of Humankind’s first computer operating systems."

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK