Module CalendarLib.Time
include Time_sig.S with type second = int
Datatypes
Second
module Second : Time_sig.Second with type t = second
Second implementation
Constructors
val lmake : ?hour:int -> ?minute:int -> ?second:second -> unit -> t
Labelled version of
make
. The default value is0
for each argument.- since
- 1.05
val now : unit -> t
The current time based on
Time_Zone.current ()
.
val midnight : unit -> t
midnight ()
is midnight (expressed in the current time zone). So, it has always the same behaviour asmake 0 0 0
.
val midday : unit -> t
midday ()
is midday (expressed in the current time zone). So, it has always the same behaviour asmake 12 0 0
.
Conversions
val convert : t -> Time_Zone.t -> Time_Zone.t -> t
val from_gmt : t -> t
from_gmt t
is equivalent toconvert t Time_Zone.GMT (Time_Zone.current ())
.
Getters
Times are comparable
val equal : t -> t -> bool
Equality function between two times.
- see Utils.Comparable.html#VALequal
Utils.Comparable.equal.
- since
- 1.09.0
val compare : t -> t -> int
Comparison function between two times.
- see Utils.Comparable.html#VALcompare
Utils.Comparable.compare.
val hash : t -> int
Hash function for times.
- see Utils.Comparable.html#VALhash
Utils.Comparable.hash.
- since
- 2.0
Boolean operations on times
Coercions
val from_minutes : float -> t
Inverse of
to_minutes
.
val from_hours : float -> t
Inverse of
to_hours
.
Period
module Period : sig ... end
A period is the number of seconds between two times.
Arithmetic operations on times and periods
val add : t -> 'a Period.period -> t
val sub : t -> t -> 'a Period.period
sub t1 t2
returns the period betweent1
andt2
.
val rem : t -> 'a Period.period -> t
rem t p
is equivalent toadd t (Period.opp p)
.