Module Calendar_builder.Make_Precise
Similar to Make but results are more precise. The counterpart is that some operations are less efficient.
- since
- 2.0
Parameters
T : Time_sig.SD : Date_sig.SSignature
Datatypes
module Date = DDate implementation used by this calendar.
module Time = TTime implementation used by this calendar.
type ttype day= Date.day=|Sun|Mon|Tue|Wed|Thu|Fri|SatDays of the week.
type month= Date.month=|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|DecMonths of the year.
type year= Date.yearYear as an int
type second= Time.secondtype field=[|Date.field|Time.field]The different fields of a calendar.
Constructors
val make : int -> int -> int -> int -> int -> second -> tmake year month day hour minute secondmakes the calendar "year-month-day; hour-minute-second".- raises D.Out_of_bounds
when a date is outside the Julian period.
- raises 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 -> tLabelled version of
make. The default value ofmonthandday(resp. ofhour,minuteandsecond) is1(resp.0).- raises D.Out_of_bounds
when a date is outside the Julian period.
- raises D.Undefined
when a date belongs to
[October 5th, 1582; October 14th, 1582].
- since
- 1.05
val now : unit -> tnow ()returns the current date and time (in the current time zone).
val from_jd : float -> tReturn the Julian day. More precise than
Date.from_jd: the fractional part represents the time.
val from_mjd : float -> tReturn the Modified Julian day. It is
Julian day - 2 400 000.5(more precise thanDate.from_mjd).
Conversions
val convert : t -> Time_Zone.t -> Time_Zone.t -> t- see Time_sig.S.html#VALconvert
Time_sig.S.convert
val to_gmt : t -> t- see Time_sig.S.html#VALto_gmt
Time_sig.S.to_gmt
val from_gmt : t -> t- see Time_sig.S.html#VALfrom_gmt
Time_sig.S.from_gmt
Getters
val days_in_month : t -> int- see Date_sig.S.html#VALdays_in_month
Date_sig.S.days_in_month
val day_of_week : t -> day- see Date_sig.S.html#VALdays_of_week
Date_sig.S.days_of_week
val day_of_month : t -> int- see Date_sig.S.html#VALdays_of_month
Date_sig.S.days_of_month
val day_of_year : t -> int- see Date_sig.S.html#VALdays_of_year
Date_sig.S.days_of_year
val week : t -> int- see Date_sig.S.html#VALweek
Date_sig.S.week
val month : t -> month- see Date_sig.S.html#VALmonth
Date_sig.S.month
val year : t -> int- see Date_sig.S.html#VALyear
Date_sig.S.year
val hour : t -> int- see Time_sig.S.html#VALhour
Time_sig.S.hour
val minute : t -> int- see Time_sig.S.html#VALminute
Time_sig.S.minute
val second : t -> second- see Time_sig.S.html#VALsecond
Time_sig.S.second
Calendars are comparable
val equal : t -> t -> boolEquality function between two calendars.
- see Utils.Comparable.html#VALequal
Utils.Comparable.equal.
val compare : t -> t -> intComparison function between two calendars.
- see Utils.Comparable.html#VALcompare
Utils.Comparable.compare.
val hash : t -> intHash function for calendars.
- see Utils.Comparable.html#VALhash
Utils.Comparable.hash.
- since
- 2.0
val is_leap_day : t -> bool- see Date_sig.S.html#VALis_leap_day
Date_sig.S.is_leap_day
val is_gregorian : t -> bool- see Date_sig.S.html#VALis_gregorian
Date_sig.S.is_gregorian
val is_julian : t -> bool- see Date_sig.S.html#VALis_julian
Date_sig.S.is_julian
val is_pm : t -> bool- see Time_sig.S.html#VALis_pm
Time_sig.S.is_pm
val is_am : t -> bool- see Time_sig.S.html#VALis_am
Time_sig.S.is_am
Coercions
val to_unixtm : t -> Unix.tmConvert a calendar into the
unix.tmtype. The fieldisdstis alwaysfalse. More precise thanDate_sig.S.to_unixtm.- since
- 1.01
val from_unixtm : Unix.tm -> tInverse of
to_unixtm. Assumes the current time zone. So, The following invariant holds:hour (from_unixtm u) = u.Unix.tm_hour.- since
- 1.01
val to_unixfloat : t -> floatConvert a calendar to a float such than
to_unixfloat (make 1970 1 1 0 0 0)returns0.0at UTC. So such a float is convertible with those of the moduleUnix. More precise thanDate_sig.S.to_unixfloat.- since
- 1.01
val from_unixfloat : float -> tInverse of
to_unixfloat. Assumes the current time zone. So, the following invariant holds:hour (from_unixfloat u) = (Unix.gmtime u).Unix.tm_hour.- since
- 1.01
Period
module Period : sig ... endA period is the number of seconds between two calendars.
Arithmetic operations on calendars and periods
val add : t -> 'a Period.period -> t- see Date_sig.S.html#VALadd
Date_sig.S.add
val sub : t -> t -> [> `Week | `Day ] Period.period- see Date_sig.S.html#VALsub
Date_sig.S.sub
val precise_sub : t -> t -> Period.t- see Date_sig.S.html#VALprecise_sub
Date_sig.S.precise_sub
- since
- 2.03
val rem : t -> 'a Period.period -> t- see Date_sig.S.html#VALrem
Date_sig.S.rem
val next : t -> field -> t- see Date_sig.S.html#VALnext
Date_sig.S.next
val prev : t -> field -> t- see Date_sig.S.html#VALprev
Date_sig.S.prev