Unix Time - Definition - Encoding Time As A Number - Non-synchronous Network Time Protocol-based Variant

Non-synchronous Network Time Protocol-based Variant

Commonly a 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'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 on 1 January 1999
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 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.

Read more about this topic:  Unix Time, Definition, Encoding Time As A Number

Famous quotes containing the words variant, network and/or time:

    “I am willing to die for my country” is a variant of “I am willing to kill for my country.”
    Mason Cooley (b. 1927)

    A culture may be conceived as a network of beliefs and purposes in which any string in the net pulls and is pulled by the others, thus perpetually changing the configuration of the whole. If the cultural element called morals takes on a new shape, we must ask what other strings have pulled it out of line. It cannot be one solitary string, nor even the strings nearby, for the network is three-dimensional at least.
    Jacques Barzun (b. 1907)

    To play is nothing but the imitative substitution of a pleasurable, superfluous and voluntary action for a serious, necessary, imperative and difficult one. At the cradle of play as well as of artistic activity there stood leisure, tedium entailed by increased spiritual mobility, a horror vacui, the need of letting forms no longer imprisoned move freely, of filling empty time with sequences of notes, empty space with sequences of form.
    Max J. Friedländer (1867–1958)