Low level time spans and time stamps.

These are unit-less and may not necessarily be in (TAI) SI seconds, and are used internally to do time scale conversions and calendar calculations. User code should use durations and instants instead.

Time spans are a time duration in some time scale represented as a ddoublestd/num/ddouble/ddouble: V; this gives it very high precision and range to represent time very precisely. (see the instant module).

A time stamp denotes an instant in time since 2000-01-01 in some time scale. Time stamps also keep track of possible leap seconds for UTC based timescales. Unix/UTC seconds.

Here is the representation of a time in the leap second just before 2006-01-01:

time(2005,12,31,23,59,60,0.5).instant.timestamp.ts-show == "189388799.500 (+1 leap)"
time(2005,12,31,23,59,60,0.5).instant.timestamp.ts-show-days == "2191d 86399.500s (+1 leap)"
time(2005,12,31,23,59,60,0.5).instant.timestamp.ts-showstd/time/timestamp/ts-show: (ts : timestamp, max-prec : ?int, secs-width : ?int, unit : ?string) -> string == "189388799.500 (+1 leap)"
time(2005,12,31,23,59,60,0.5).instant.timestamp.ts-show-daysstd/time/timestamp/ts-show-days: (ts : timestamp, prec : ?int) -> string == "2191d 86399.500s (+1 leap)"

The leapstd/time/timestamp/leap: (timestamp : timestamp) -> int field also lets us represent leap times that occurred at another time than the last second of the day:

time(1959,1,28,18,59,59,0.01).instant.timestamp.ts-show-days == "-14948d 68399.010s"
time(1959,1,28,18,59,60,0.01).instant.timestamp.ts-show-days == "-14948d 68399.010s (+1 leap)"
time(1959,1,28,19, 0, 0,0.01).instant.timestamp.ts-show-days == "-14948d 68400.010s"
time(1959,1,28,18,59,59,0.01).instant.timestamp.ts-show-daysstd/time/timestamp/ts-show-days: (ts : timestamp, prec : ?int) -> string == "-14948d 68399.010s"
time(1959,1,28,18,59,60,0.01).instant.timestamp.ts-show-daysstd/time/timestamp/ts-show-days: (ts : timestamp, prec : ?int) -> string == "-14948d 68399.010s (+1 leap)"
time(1959,1,28,19, 0, 0,0.01).instant.timestamp.ts-show-daysstd/time/timestamp/ts-show-days: (ts : timestamp, prec : ?int) -> string == "-14948d 68400.010s"

See std/time/utc for more information on leap seconds.

Return days and clock into the day, handling possible leap seconds.

Return days and seconds into the day, disregarding leap seconds.

Round a time stamp to a certain precision (prec is number of digits of the fraction of the second).

The time span since 2000-01-01 for time scales that do not have leap seconds and where every day is 86400s. For time scales with leap seconds, this effectively ignores any leap seconds.

Create a time stamp from a timespanstd/time/timestamp/timespan: V since 2000-01-01 and possible leap seconds.

Timestamp from days, seconds into the day and possible leap second.

Create a time stamp from an integer timespan since 2000-01-01 and possible leap seconds.

The time stamp at 2000-01-01.

The time span since 2000-01-01 including time inside a possible leap second.

Divide using divstd/time/timestamp/div: (x : timespan, y : timespan, prec : ?int) -> timespan to allow for different timespan representations.

Seconds in a solar day, 86400.

A zero-valued timespan.