module Time:Time_sig.S
Time implementation used by this calendar.
type t
Type of a time.
typefield =[ `Hour | `Minute | `Second ]
The different fields of a time.
type second
Type of a second.
module Second:Time_sig.Secondwith type t = second
Second implementation
val make : int -> int -> second -> tmake hour minute second makes the time hour-minute-second.
val lmake : ?hour:int -> ?minute:int -> ?second:second -> unit -> tLabelled version of make. The default value is 0 for each argument.
val now : unit -> tThe current time based on Time_Zone.current ().
val midnight : unit -> tmidnight () is midnight (expressed in the current time zone).
So, it has always the same behaviour as make 0 0 0.
val midday : unit -> tmidday () is midday (expressed in the current time zone).
So, it has always the same behaviour as make 12 0 0.
val convert : t -> Time_Zone.t -> Time_Zone.t -> tconvert t t1 t2 converts the time t expressed in the time zone t1
to the same time expressed in the time zone t2.
convert (make 20 0 0) (Time_Zone.GMT_Plus 2)
(Time_Zone.GMT_Plus 4) returns the time 22-0-0.val from_gmt : t -> tfrom_gmt t is equivalent to
convert t Time_Zone.GMT (Time_Zone.current ()).
val to_gmt : t -> tto_gmt t is equivalent to
convert t (Time_Zone.current ()) Time_Zone.GMT.
val normalize : t -> t * intnormalize t returns t such that hour t belongs to [0; 24[. The
second component of the result is the number of days needed by the
modification.
normalize (make 22 0 0) returns the time 22-0-0 and 0,
normalize (make 73 0 0) returns the time 1-0-0 and 3 and normalize
(make (-73) 0 0) returns the time 23-0-0 and (-4).val hour : t -> intHour.
hour (make 20 0 0) returns 20.val minute : t -> intMinute.
minute (make 20 10 0) returns 10.val second : t -> secondSecond.
second (make 20 10 5) returns 5.val to_seconds : t -> secondNumber of seconds of a time.
to_seconds (make 1 2 3) returns 3600 + 120 + 3 = 3723.val to_minutes : t -> floatNumber of minutes of a time. The resulting fractional part represents seconds.
to_minutes (make 1 2 3) returns 60+2+0.05 = 62.05.val to_hours : t -> floatNumber of hours of a time. The resulting fractional part represents minutes and seconds.
to_hours (make 1 3 0) returns 1 + 0.05 = 1.05.val equal : t -> t -> boolEquality function between two times.
val compare : t -> t -> intComparison function between two times.
val hash : t -> intHash function for times.
val is_pm : t -> boolReturn true is the time is before midday in the current time zone;
false otherwise.
is_pm (make 10 0 0) and is_pm (make 34 0 0) return
true.val is_am : t -> boolReturn true is the time is after midday in the current time zone;
false otherwise.
is_am (make 20 0 0) and is_am (make 44 0 0) return
true.val from_seconds : second -> tInverse of to_seconds.
val from_minutes : float -> tInverse of to_minutes.
val from_hours : float -> tInverse of to_hours.
module Period:sig..end
A period is the number of seconds between two times.
val add : t ->
[< Period.date_field ] Period.period -> tapp t p returns t + p.
add (make 20 0 0) (Period.minute 70) returns the time
21:10:0.val sub : t ->
t -> [< Period.date_field ] Period.periodsub t1 t2 returns the period between t1 and t2.
val rem : t ->
[< Period.date_field ] Period.period -> trem t p is equivalent to add t (Period.opp p).
val next : t -> field -> tnext t f returns the time corresponding to the next specified field.
next (make 20 3 31) `Minute returns the time 20:04:31.
(i.e. one minute later).val prev : t -> field -> tprev t f returns the time corresponding to the previous specified
field.
prev (make 20 3 31) `Second returns the time 20:03:30
(i.e. one second ago).