Time

A collection of ways to fetch the current time.

primitive val Time

Constructors

create

new val create()
: Time val^

Returns


Public Functions

now

The wall-clock adjusted system time with nanoseconds. Return: (seconds, nanoseconds)

fun box now()
: (I64 val , I64 val)

Returns


seconds

The wall-clock adjusted system time.

fun box seconds()
: I64 val

Returns


millis

Monotonic unadjusted milliseconds.

fun box millis()
: U64 val

Returns


micros

Monotonic unadjusted microseconds.

fun box micros()
: U64 val

Returns


nanos

Monotonic unadjusted nanoseconds.

fun box nanos()
: U64 val

Returns


cycles

Processor cycle count. Don't use this for performance timing, as it does not control for out-of-order execution.

fun box cycles()
: U64 val

Returns


perf_begin

Get a cycle count for beginning a performance testing block. This will will prevent instructions from before this call leaking into the block and instructions after this call being executed earlier.

fun box perf_begin()
: U64 val

Returns


perf_end

Get a cycle count for ending a performance testing block. This will will prevent instructions from after this call leaking into the block and instructions before this call being executed later.

fun box perf_end()
: U64 val

Returns


eq

fun box eq(
  that: Time val)
: Bool val

Parameters

Returns


ne

fun box ne(
  that: Time val)
: Bool val

Parameters

Returns


Private Functions

_clock_gettime

Return a clock time on linux and bsd.

fun box _clock_gettime(
  clock: (_ClockRealtime val | _ClockMonotonic val))
: (I64 val , I64 val)

Parameters

Returns


_query_performance_counter

Return QPC and QPF.

fun box _query_performance_counter()
: (U64 val , U64 val)

Returns