module Period: sig
.. end
A period is the number of seconds between two calendars.
Arithmetic operations
include Period.S
Constructors
val make : int -> int -> int -> int -> int -> Calendar_sig.S.second -> Calendar_sig.S.t
make year month day hour minute second
makes a period of the
specified length.
val lmake : ?year:int ->
?month:int ->
?day:int ->
?hour:int ->
?minute:int -> ?second:Calendar_sig.S.second -> unit -> Calendar_sig.S.t
Labelled version of make
.
The default value of each argument is 0
.
Those functions have the same behavious as those defined in
Date_sig.S.Period
.
val year : int -> Calendar_sig.S.t
val month : int -> Calendar_sig.S.t
val week : int -> Calendar_sig.S.t
val day : int -> Calendar_sig.S.t
Those functions have the same behavious as those defined in
.
val hour : int -> Calendar_sig.S.t
val minute : int -> Calendar_sig.S.t
val second : Calendar_sig.S.second -> Calendar_sig.S.t
Coercions
val from_date : Date.Period.t -> Calendar_sig.S.t
Convert a date period to a calendar period.
val from_time : Time.Period.t -> Calendar_sig.S.t
Convert a time period to a calendar period.
val to_date : Calendar_sig.S.t -> Date.Period.t
Convert a calendar period to a date period.
The fractional time period is ignored.
Example: to_date (hour 60)
is equivalent to Date.Period.days 2
.
exception Not_computable
= Date.Period.Not_computable
.
Since 1.04
val to_time : Calendar_sig.S.t -> Time.Period.t
Convert a calendar period to a date period.
Since 1.04
Raises Not_computable
if the time period is not computable.
Examples:to_time (year 1)
raises Not_computable
because
a year is not a constant number of days.
to_time (second 30)
returns a time period of 30
seconds
to_time (day 6)
returns a time period of 24 * 3600 * 6 =
518400
seconds
val ymds : Calendar_sig.S.t -> int * int * int * Calendar_sig.S.second
Number of years, months, days and seconds in a period.
Since 1.09.0
Examples:ymds (make (-1) (-2) (-3) (-1) (-2) (-3)
returns
-1, -2, -4, 82677
.
ymds (make 1 2 3 1 2 3)
returns 1, 2, 3, 3723