module Period: sig
.. end
A period is the number of seconds between two times.
Arithmetic operations
include Period.S
val length : Time.t -> int
Number of seconds of a period.
val mul : Time.t -> Time.t -> Time.t
Multiplication.
val div : Time.t -> Time.t -> Time.t
Division.
Constructors
val make : int -> int -> int -> Time.t
make hour minute second
makes a period of the specified length.
val lmake : ?hour:int -> ?minute:int -> ?second:int -> unit -> Time.t
Labelled version of make
.
The default value is 0
for each argument.
val hour : int -> Time.t
hour n
makes a period of n
hours.
val minute : int -> Time.t
minute n
makes a period of n
minutes.
val second : int -> Time.t
second n
makes a period of n
seconds.
Getters
val to_seconds : Time.t -> int
Number of seconds of a period.
E.g. to_seconds (make 1 2 3)
returns 3600 + 120 + 3 = 3723
.
val to_minutes : Time.t -> float
Number of minutes of a period. The resulting fractional part
represents seconds.
E.g. to_minutes (make 1 2 3)
returns 60 + 2 + 0.05 = 62.05
.
val to_hours : Time.t -> float
Number of hours of a period. The resulting fractional part represents
minutes and seconds.
E.g. to_hours (make 1 3 0)
returns 1 + 0.05 = 1.05
.