module type S =sig
..end
module Date:Date_sig.S
module Time:Time_sig.S
type
t
typeday =
Date.day
=
| |
Sun |
|||
| |
Mon |
|||
| |
Tue |
|||
| |
Wed |
|||
| |
Thu |
|||
| |
Fri |
|||
| |
Sat |
(* |
Days of the week.
| *) |
typemonth =
Date.month
=
| |
Jan |
|||
| |
Feb |
|||
| |
Mar |
|||
| |
Apr |
|||
| |
May |
|||
| |
Jun |
|||
| |
Jul |
|||
| |
Aug |
|||
| |
Sep |
|||
| |
Oct |
|||
| |
Nov |
|||
| |
Dec |
(* |
Months of the year.
| *) |
typeyear =
Date.year
typesecond =
Time.second
typefield =
[ `Day | `Hour | `Minute | `Month | `Second | `Week | `Year ]
val make : int -> int -> int -> int -> int -> second -> t
make year month day hour minute second
makes the calendar
"year-month-day; hour-minute-second".D.Out_of_bounds
when a date is outside the Julian period.D.Undefined
when a date belongs to [October 5th, 1582; October
14th, 1582]
.val lmake : year:int ->
?month:int ->
?day:int ->
?hour:int ->
?minute:int -> ?second:second -> unit -> t
make
.
The default value of month
and day
(resp. of hour
, minute
and second
) is 1
(resp. 0
).D.Out_of_bounds
when a date is outside the Julian period.D.Undefined
when a date belongs to [October 5th, 1582; October
14th, 1582]
.val create : Date.t -> Time.t -> t
create d t
creates a calendar from the given date and time.val now : unit -> t
now ()
returns the current date and time (in the current time
zone).val from_jd : float -> t
Date.from_jd
: the fractional part represents the
time.val from_mjd : float -> t
Julian day - 2 400 000.5
(more precise than Date.from_mjd
).Time_sig.S
.val convert : t -> Time_Zone.t -> Time_Zone.t -> t
val to_gmt : t -> t
val from_gmt : t -> t
Date_sig.S
.val days_in_month : t -> int
val day_of_week : t -> day
val day_of_month : t -> int
val day_of_year : t -> int
val week : t -> int
val month : t -> month
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
Time_sig.S
.val hour : t -> int
val minute : t -> int
val second : t -> second
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
Date_sig.S
.val is_leap_day : t -> bool
val is_gregorian : t -> bool
val is_julian : t -> bool
Time_sig.S
.val is_pm : t -> bool
val is_am : t -> bool
val to_unixtm : t -> Unix.tm
unix.tm
type.
The field isdst
is always false
. More precise than
Date_sig.S.to_unixtm
.val from_unixtm : Unix.tm -> t
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
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
to_unixfloat
. Assumes the current time zone.
So, the following invariant holds:
hour (from_unixfloat u) = (Unix.gmtime u).Unix.tm_hour
.val from_date : Date.t -> t
val to_date : t -> Date.t
val to_time : t -> Time.t
module Period:sig
..end
Date_sig.S
.val add : t ->
[< Period.date_field ] Period.period -> t
val sub : t ->
t ->
[< Period.date_field > `Day `Week ] Period.period
val precise_sub : t -> t -> Period.t
val rem : t ->
[< Period.date_field ] Period.period -> t
val next : t -> field -> t
val prev : t -> field -> t