ClockGetTime v0.1.0

Source
Reads the current value of a Linux clock.

Package: Linux

Signature

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

Parameters

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

Returns

int640 on success, or a negative errno result on failure.

Description

Use ClockRealtime for calendar time that can jump when the system clock is adjusted. Use ClockMonotonic for elapsed-time measurements; it is not affected by discontinuous wall-clock changes.

Example

import Linux::{ ClockGetTime, IsError, Timespec, ClockMonotonic };

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

See also