Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Unix time
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Non-synchronous Network Time Protocol-based variant ==== Commonly a [[David L. Mills|Mills]]-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 described by Mills' paper.<ref name="eeci_TheN">{{Cite web | title = The NTP Timescale and Leap Seconds | last = Mills | first = David L. | work = eecis.udel.edu | date = 12 May 2012 | access-date = 21 August 2017 | url = https://www.eecis.udel.edu/~mills/leap.html | archive-date = 15 May 2012 | archive-url = https://web.archive.org/web/20120515005611/http://www.eecis.udel.edu/~mills/leap.html | url-status = live }}</ref> This is what happens across a positive leap second: {| class="wikitable" style="text-align: center;" |+ Non-synchronous Mills-style Unix clock<br>across midnight into 1 January 1999 (positive leap second) |- ! TAI (1 January 1999) ! UTC (31 December 1998 to 1 January 1999) ! State ! Unix clock |- | 1999-01-01T00:00:29.75 | 1998-12-31T23:59:58.75 | TIME_INS | style="text-align: right;" | {{val|915148798.75}} |- | 1999-01-01T00:00:30.00 | 1998-12-31T23:59:59.00 | TIME_INS | style="text-align: right;" | {{val|915148799.00}} |- | 1999-01-01T00:00:30.25 | 1998-12-31T23:59:59.25 | TIME_INS | style="text-align: right;" | {{val|915148799.25}} |- | 1999-01-01T00:00:30.50 | 1998-12-31T23:59:59.50 | TIME_INS | style="text-align: right;" | {{val|915148799.50}} |- | 1999-01-01T00:00:30.75 | 1998-12-31T23:59:59.75 | TIME_INS | style="text-align: right;" | {{val|915148799.75}} |- ! 1999-01-01T00:00:31.00 ! 1998-12-31T23:59:60.00 ! TIME_INS ! style="text-align: right;" | {{val|915148800.00}} |- ! 1999-01-01T00:00:31.25 ! 1998-12-31T23:59:60.25 ! TIME_OOP ! style="text-align: right;" | {{val|915148799.25}} |- | 1999-01-01T00:00:31.50 | 1998-12-31T23:59:60.50 | TIME_OOP | style="text-align: right;" | {{val|915148799.50}} |- ! 1999-01-01T00:00:31.75 ! 1998-12-31T23:59:60.75 ! TIME_OOP ! style="text-align: right;" | {{val|915148799.75}} |- ! 1999-01-01T00:00:32.00 ! 1999-01-01T00:00:00.00 ! TIME_OOP ! style="text-align: right;" | {{val|915148800.00}} |- | 1999-01-01T00:00:32.25 | 1999-01-01T00:00:00.25 | TIME_WAIT | style="text-align: right;" | {{val|915148800.25}} |- | 1999-01-01T00:00:32.50 | 1999-01-01T00:00:00.50 | TIME_WAIT | style="text-align: right;" | {{val|915148800.50}} |- | 1999-01-01T00:00:32.75 | 1999-01-01T00:00:00.75 | TIME_WAIT | style="text-align: right;" | {{val|915148800.75}} |- | 1999-01-01T00:00:33.00 | 1999-01-01T00:00:01.00 | TIME_WAIT | style="text-align: right;" | {{val|915148801.00}} |- | 1999-01-01T00:00:33.25 | 1999-01-01T00:00:01.25 | TIME_WAIT | style="text-align: right;" | {{val|915148801.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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)