ClockGetTime v0.1.0

Source
Reads the current value of a BSD clock.

Package: Bsd

Signature

func ClockGetTime(clk_id: int32, tp: *Timespec) -> int64;

Parameters

NameTypeDescription
clk_idint32Clock to read, such as ClockMonotonic.
tp*TimespecWritable destination for the clock value.

Returns

int64 - 0 on success, or a negative errno value on failure.

The compiler-provided thunk selects the target BSD syscall. Use ClockRealtime for adjustable wall-clock time and ClockMonotonic for elapsed-time measurements.

Example

import Bsd::{ ClockGetTime, Timespec, ClockMonotonic };

func Main() -> int {
    var now: Timespec;
    if ClockGetTime(ClockMonotonic, @now) != 0i64 {
        return 1;
    }
    return 0;
}

See also