std/time/chrono▲toc

Get the system time.

.

fun now(): <ndetstd/core/types/ndet: X,utcstd/time/utc/utc: (E, V) -> V> instantstd/time/instant/instant: V

The current instantstd/time/instant/instant: V in time as returned by the system clock in the UTC timescale. Equivalent to now-instd/time/chrono/now-in: (ts : ? timescale) -> ndet instant(utcstd/time/utc/utc: () -> utc timescale()), see now-instd/time/chrono/now-in: (ts : ? timescale) -> ndet instant for further information about the system clock.

fun now-in( ts : ? timescalestd/time/instant/timescale: V ) : ndetstd/core/types/ndet: X instantstd/time/instant/instant: V

The current instantstd/time/instant/instant: V in time as returned by the system clock in an optional time scale ts (= ts-tistd/time/utc/ts-ti: timescale).

This uses the best available system clock for the requested timescale. For example it uses CLOCK_UTC when available to get proper UTC time, or CLOCK_TAI for TAI time.

Otherwise, it usually uses Unix (POSIX) time (CLOCK_REALTIME). Unfortunately, most operating systems cannot not report time in leap seconds accurately. The nowstd/time/chrono/now: () -> <ndet,utc> instant function is limited by the OS in this case.

To guard against inaccurate clocks and increase monotonicity, the nowstd/time/chrono/now: () -> <ndet,utc> instant function guarantees that if the current measurement is upto 1 second in the past with regard to the previous call to nowstd/time/chrono/now: () -> <ndet,utc> instant, that the returned instant is monotonic by adding nano seconds to the previous measurement until the system clock catches up again.

This is effective in particular on older OS's where the time sometimes jumps back one second after a leap second. By limiting the adjustment to at most one second it ensures the clock catches up soon and does not affect the user setting a new time in the past.

fun now-resolution(): ndetstd/core/types/ndet: X durationstd/time/duration/duration: V

Return the smallest time difference that the system clock can measure.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/core/exnstd/core/exn, std/core/boolstd/core/bool, std/core/orderstd/core/order, std/core/charstd/core/char, std/core/intstd/core/int, std/core/vectorstd/core/vector, std/core/stringstd/core/string, std/core/sslicestd/core/sslice, std/core/liststd/core/list, std/core/maybestd/core/maybe, std/core/eitherstd/core/either, std/core/tuplestd/core/tuple, std/core/showstd/core/show, std/core/debugstd/core/debug, std/core/delayedstd/core/delayed, std/core/consolestd/core/console, std/corestd/core, std/time/timestampstd/time/timestamp, std/time/durationstd/time/duration, std/time/instantstd/time/instant, std/time/utcstd/time/utc, std/num/ddoublestd/num/ddouble