Module Time.Period

A period is the number of seconds between two times.

Arithmetic operations

include Period.S
type +'a period constraint 'a = [< date_field ]
type t = Period.date_field period

Type of a period.

Period is an additive monoid

val empty : 'a period

The empty period.

val add : 'a period -> 'a period -> 'a period

Addition of periods.

val sub : 'a period -> 'a period -> 'a period

Substraction of periods.

val opp : 'a period -> 'a period

Opposite of a period.

Periods are comparable

val equal : 'a period -> 'b period -> bool

Equality function between two periods.

see Utils.Comparable.html#VALequal

Utils.Comparable.equal

since
1.09.0
val compare : 'a period -> 'b period -> int

Comparison function between two periods.

see Utils.Comparable.html#VALcompare

Utils.Comparable.compare

val hash : 'a period -> int

Hash function for periods.

see Utils.Comparable.html#VALhash

Utils.Comparable.hash

since
2.0
val length : 'a period -> second

Number of seconds of a period.

val mul : 'a period -> 'a period -> 'a period

Multiplication.

val div : 'a period -> 'a period -> 'a period

Division.

Constructors

val make : int -> int -> second -> 'a period

make hour minute second makes a period of the specified length.

val lmake : ?⁠hour:int -> ?⁠minute:int -> ?⁠second:second -> unit -> 'a period

Labelled version of make. The default value is 0 for each argument.

val hour : int -> 'a period

hour n makes a period of n hours.

val minute : int -> 'a period

minute n makes a period of n minutes.

val second : second -> 'a period

second n makes a period of n seconds.

Getters

val to_seconds : 'a period -> second
val to_minutes : 'a period -> float
val to_hours : 'a period -> float