module Period:sig..end
A period is the number of seconds between two calendars.
type +[< Period.date_field ] period
typet =Period.date_field period
Type of a period.
val empty : [< Period.date_field ] periodThe empty period.
val add : ([< Period.date_field > `Day `Week ] as 'a) period ->
'a period -> 'a periodAddition of periods.
val sub : ([< Period.date_field > `Day `Week ] as 'a) period ->
'a period -> 'a periodSubstraction of periods.
val opp : ([< Period.date_field > `Day `Week ] as 'a) period ->
'a periodOpposite of a period.
val equal : [< Period.date_field ] period ->
[< Period.date_field ] period -> boolEquality function between two periods.
val compare : [< Period.date_field ] period ->
[< Period.date_field ] period -> intComparison function between two periods.
val hash : [< Period.date_field ] period -> intHash function for periods.
val make : int ->
int -> int -> int -> int -> Calendar_sig.S.second -> tmake 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 -> tLabelled 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 -> [< Period.date_field > `Year ] periodval month : int -> [< Period.date_field > `Month `Year ] periodval week : int -> [< Period.date_field > `Day `Week ] periodval day : int -> [< Period.date_field > `Day `Week ] periodThose functions have the same behavious as those defined in .
val hour : int -> [< Period.date_field > `Day `Week ] periodval minute : int -> [< Period.date_field > `Day `Week ] periodval second : Calendar_sig.S.second ->
[< Period.date_field > `Day `Week ] periodval from_date : ([< Period.date_field ] as 'a) Date.Period.period ->
'a periodConvert a date period to a calendar period.
val from_time : ([< Period.date_field ] as 'a) Time.Period.period ->
'a periodConvert a time period to a calendar period.
val to_date : ([< Date.field ] as 'a) period -> 'a Date.Period.periodConvert a calendar period to a date period. The fractional time period is ignored.
to_date (hour 60) is equivalent to Date.Period.days 2.exception Not_computable
= Date.Period.Not_computable.
val to_time : ([< Period.date_field ] as 'a) period ->
'a Time.Period.periodCalendar_sig.S.Period.safe_to_time insteadConvert a calendar period to a date period.
Not_computable if the time period is not computable.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 secondsto_time (day 6) returns a time period of 24 * 3600 * 6 =
518400 secondsval safe_to_time : ([< `Day | `Week ] as 'a) period ->
'a Time.Period.periodEquivalent to Calendar_sig.S.Period.to_time but never raises any exception.
val ymds : [< Period.date_field ] period ->
int * int * int * Calendar_sig.S.secondNumber of years, months, days and seconds in a period.
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