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.
since
where daysstd/time/timestamp/days: (ts : timestamp) -> int == floor(since / 86400)
and seconds == since - daysstd/time/timestamp/days: (ts : timestamp) -> int
.
This is essentially the representation that Unix/Posic timestamps use too.
leapstd/time/timestamp/leap: (t : timestamp) -> int
seconds field
to represent time in a leap step unambigiously (and also at any time during the day).
The leapstd/time/timestamp/leap: (t : timestamp) -> int
field is positive if this time is in a leap step.
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: (t : 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 utc
for more information on leap seconds.
Create a time stamp from an integer timespan since 2000-01-01 and possible leap seconds.
Add a time span to a time stamp.
Subtract a time span from a time stamp.
Add daysstd/time/timestamp/days: (ts : timestamp) -> int
days to a timestamp.
Add leaps
leap seconds to the timestamp.
Compare two timestampstd/time/timestamp/timestamp: V
s.
Return days and clock into the day, handling possible leap seconds.
Return days and seconds into the day, disregarding leap seconds.
The maximum of two timestamps.
The minimum of two timestamps.
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.
The time stamp at 2000-01-01.
Show a time stamp.
Show a day stamp.
The time span since 2000-01-01 including time inside a possible leap second.
Timespan from a ddoublestd/num/ddouble/ddouble: V
. Just for convenience as timespanstd/time/timestamp/timespan: V
is an alias.
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.
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
duration
s andinstant
s instead.