4.39. kink/datetime/INSTANT

Provides instant class.

4.39.1. type instant

An instant is a point of time on the time line.

An instant consists of a nanosecond precision epoch time, which is an elapsed time from 1970-01-01T00:00:00Z. The definition of the length of seconds follows the Java Time-Scale:

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Instant.html

Thus, no leap seconds are inserted to the epoch time of an instant.

The scale of the epoch time is 9.

The range of epoch time is [-999999999999.999999999, 999999999999.999999999]. The minimum and the maximum values represent 29720 BC and AD 33658 respectively in ISO 8601 calendar system.

4.39.1.1. Ins.epoch_time

“epoch_time” method returns the epoch time of the instant.

The result is a num, the scale of which is 9.

4.39.1.2. I1 < I2, I1 <= I2, I1 == I2, I1 != I2, I1 >= I2, I1 > I2

Instants are comparable based on the order of the epoch times.

4.39.1.3. Ins.repr

`repr` returns the str representation of the instant such as "(instant 1580445786.123456789)".

4.39.2. INSTANT.new(Epoch_time)

INSTANT.new fun makes an instant val representing the Epoch_time.

Preconditions:

• Epoch_time must be a num.

• The scale of Epoch_time must be less than or equal to 9.

• Epoch_time must be in the range [-999999999999.999999999, 999999999999.999999999].

4.39.3. INSTANT.now

INSTANT.now returns an instant val of the current instant provided by the system clock.

The result is not guarunteed to to progress monotonically, or smoothly. For example, when the system clock is synchronized, the result can move back or jump forward.

If you want to measure the elapsed machine time, use STOPWATCH.start. See kink/STOPWATCH.

4.39.4. INSTANT.is?(Val)

INSTANT.is? returns whether Val is an instant val.