Calendar_builder.Make_Precise
Similar to Make
but results are more precise. The counterpart is that some operations are less efficient.
module D : Date_sig.S
module T : Time_sig.S
module Date = D
Date implementation used by this calendar.
module Time = T
Time implementation used by this calendar.
type month = Date.month =
| Jan | |
| Feb | |
| Mar | |
| Apr | |
| May | |
| Jun | |
| Jul | |
| Aug | |
| Sep | |
| Oct | |
| Nov | |
| Dec | (* Months of the year. *) |
type year = Date.year
Year as an int
type second = Time.second
The different fields of a calendar.
make year month day hour minute second
makes the calendar "year-month-day; hour-minute-second".
val lmake :
year:int ->
?month:int ->
?day:int ->
?hour:int ->
?minute:int ->
?second:second ->
unit ->
t
Labelled version of make
. The default value of month
and day
(resp. of hour
, minute
and second
) is 1
(resp. 0
).
val now : unit -> t
now ()
returns the current date and time (in the current time zone).
val from_jd : float -> t
Return the Julian day. More precise than Date.from_jd
: the fractional part represents the time.
val from_mjd : float -> t
Return the Modified Julian day. It is Julian day - 2 400 000.5
(more precise than Date.from_mjd
).
Those functions have the same behaviour as those defined in Time_sig.S
.
val convert : t -> Time_Zone.t -> Time_Zone.t -> t
Those functions have the same behavious as those defined in Date_sig.S
.
val days_in_month : t -> int
val day_of_month : t -> int
val day_of_year : t -> int
val week : t -> int
val year : t -> int
to_jd
and to_mjd
are more precise than Date_sig.S.to_jd
and Date_sig.S.to_mjd
.
val to_jd : t -> float
val to_mjd : t -> float
Those functions have the same behavious as those defined in Time_sig.S
.
val hour : t -> int
val minute : t -> int
val hash : t -> int
Hash function for calendars.
Those functions have the same behavious as those defined in Date_sig.S
.
val is_leap_day : t -> bool
val is_gregorian : t -> bool
val is_julian : t -> bool
Those functions have the same behavious as those defined in Time_sig.S
.
val is_pm : t -> bool
val is_am : t -> bool
val to_unixtm : t -> Unix.tm
Convert a calendar into the unix.tm
type. The field isdst
is always false
. More precise than Date_sig.S.to_unixtm
.
val from_unixtm : Unix.tm -> t
Inverse of to_unixtm
. Assumes the current time zone. So, The following invariant holds: hour (from_unixtm u) = u.Unix.tm_hour
.
val to_unixfloat : t -> float
Convert a calendar to a float such than to_unixfloat (make 1970 1 1 0 0 0)
returns 0.0
at UTC. So such a float is convertible with those of the module Unix
. More precise than Date_sig.S.to_unixfloat
.
val from_unixfloat : float -> t
Inverse of to_unixfloat
. Assumes the current time zone. So, the following invariant holds: hour (from_unixfloat u) = (Unix.gmtime u).Unix.tm_hour
.
Convert a date to a calendar. The time is midnight in the current time zone.
module Period : sig ... end
A period is the number of seconds between two calendars.
Those functions have the same behavious as those defined in Date_sig.S
.
val add : t -> 'a Period.period -> t
val sub : t -> t -> [> `Week | `Day ] Period.period
val rem : t -> 'a Period.period -> t