package posix-clock

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

POSIX clocks

  • author Markus W. Weissmann
module Clock : sig ... end
val clock_getres : Clock.t -> (Posix_time.Timespec.t, [> `EUnix of Unix.error ]) Result.result

clock_getres clock returns the resolution (precision) of the specified clock. If the clock clock is not supported by the operating system, Error is returned.

val clock_gettime : Clock.t -> (Posix_time.Timespec.t, [> `EUnix of Unix.error ]) Result.result

clock_gettime clock retrieves the time of the clock clock. If the clock clock is not supported by the operating system, Error is returned.

val clock_settime : Clock.t -> Posix_time.Timespec.t -> (unit, [> `EUnix of Unix.error ]) Result.result

clock_settime clock time sets the time of the clock clock to time. If the clock clock is not supported by the operating system, Error is returned.

val nanosleep : Posix_time.Timespec.t -> (Posix_time.Timespec.t option, [> `EUnix of Unix.error ]) Result.result

nanosleep time lets the system sleep for time. If the call was interrupted by a signal, the Ok return value will bring Some time value carrying the remaining time -- otherwise None.

val clock_nanosleep : Clock.t -> ?abs:bool -> Posix_time.Timespec.t -> (Posix_time.Timespec.t option, [> `EUnix of Unix.error ]) Result.result

clock_nanosleep clock time ~abs:a lets the system sleep for time. The duration is based on the clock clock. time either gives a relative time when ~abs is false or an absolute time when ~abs is true. The default case is relative time. The return value is analog to nanosleep.

val clock_getcpuclockid : int -> (Clock.t, [> `EUnix of Unix.error ]) Result.result

clock_getcpuclockid pid returns the clock for the process of the given process-id pid.