package posix-time

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = private {
  1. tv_sec : int64;
  2. tv_usec : int64;
}

POSIX timeval time value with seconds and microseconds. A normalized value of type t must have a value of tv_usec between 0 and 1000000 (exclusive).

val create : int64 -> int64 -> t

create sec usec creates a new normalized timespec with sec seconds and usec microseconds.

val add : t -> t -> t

add t1 t2 adds the two timespec values, returning a normalized value

val sub : t -> t -> t

sub t1 t2 subtracts t2 from t1, creating a new normalized time value.

val add_sec : int64 -> t -> t

add_sec s t adds s seconds to t.

val add_usec : int64 -> t -> t

add_sec us t adds us microseconds to t.

val sub_sec : int64 -> t -> t

sub_sec s t subtracts s seconds from t.

val sub_usec : int64 -> t -> t

sub_sec us t subtracts us microseconds from t.

val to_string : t -> string

to_string t creates a string of the form "sec.usec".

val compare : t -> t -> int

compare t1 t2 compares the two time values t1 and t2. It returns 0 if t1 is equal to 2, a negative integer if t1 is less than t2, and a positive integer if t1 is greater than t2.

OCaml

Innovation. Community. Security.