123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512open!ImportmoduletypeSpan=sig(** [t] is immediate on 64bit boxes and so plays nicely with the GC write barrier. *)typet=privateInt63.t[@@derivinghash]includeSpan_intf.Swithtypeunderlying=Int63.tandtypet:=tvalof_sec_with_microsecond_precision:float->tvalof_int_us:int->tvalof_int_ms:int->tvalto_int_us:t->intvalto_int_ms:t->intvalto_int_sec:t->int(** The minimum representable time span. *)valmin_value_representable:t(** The maximum representable time span. *)valmax_value_representable:t(** The minimum span that rounds to a [Time.Span.t] with microsecond precision. *)valmin_value_for_1us_rounding:t(** The maximum span that rounds to a [Time.Span.t] with microsecond precision. *)valmax_value_for_1us_rounding:t(** An alias for [min_value_for_1us_rounding]. *)valmin_value:t[@@deprecated"[since 2019-02] use [min_value_representable] or [min_value_for_1us_rounding] \
instead"](** An alias for [max_value_for_1us_rounding]. *)valmax_value:t[@@deprecated"[since 2019-02] use [max_value_representable] or [max_value_for_1us_rounding] \
instead"](** overflows silently *)valscale_int:t->int->t(** overflows silently *)valscale_int63:t->Int63.t->t(** Rounds down, and raises unless denominator is positive. *)valdiv:t->t->Int63.t(** Fast, implemented as the identity function. *)valto_int63_ns:t->Int63.t(** Fast, implemented as the identity function. *)valof_int63_ns:Int63.t->t(** Will raise on 32-bit platforms. Consider [to_int63_ns] instead. *)valto_int_ns:t->intvalof_int_ns:int->tvalsince_unix_epoch:unit->tvalrandom:?state:Random.State.t->unit->t(** WARNING!!! [to_span] and [of_span] both round to the nearest 1us.
Around 135y magnitudes [to_span] and [of_span] raise.
*)valto_span:t->Span_float.t[@@deprecated"[since 2019-01] use [to_span_float_round_nearest] or \
[to_span_float_round_nearest_microsecond]"]valof_span:Span_float.t->t[@@deprecated"[since 2019-01] use [of_span_float_round_nearest] or \
[of_span_float_round_nearest_microsecond]"](** [*_round_nearest] vs [*_round_nearest_microsecond]: If you don't know that you need
microsecond precision, use the [*_round_nearest] version.
[*_round_nearest_microsecond] is for historical purposes. *)valto_span_float_round_nearest:t->Span_float.tvalto_span_float_round_nearest_microsecond:t->Span_float.tvalof_span_float_round_nearest:Span_float.t->tvalof_span_float_round_nearest_microsecond:Span_float.t->t(** Note that we expose a sexp format that is not the one exposed in [Core]. *)moduleAlternate_sexp:sigtypenonrect=t[@@derivingsexp,sexp_grammar]end[@@deprecated"[since 2018-04] use [Span.sexp_of_t] and [Span.t_of_sexp] instead"]valarg_type:tCommand.Arg_type.t(** [Span.Option.t] is like [Span.t option], except that the value is immediate on
architectures where [Int63.t] is immediate. This module should mainly be used to
avoid allocations. *)moduleOption:sigincludeImmediate_option.S_int63withtypevalue:=tincludeIdentifiable.Swithtypet:=tincludeQuickcheck.Swithtypet:=tmoduleStable:sigmoduleV1:Stable_int63able.With_stable_witness.Swithtypet=tmoduleV2:Stable_int63able.With_stable_witness.Swithtypet=tendendmoduleStable:sigmoduleV1:sigtypenonrect=t[@@derivinghash,equal]includeStable_int63able.With_stable_witness.Swithtypet:=tendmoduleV2:sigtypenonrect=t[@@derivinghash,equal,sexp_grammar]typenonreccomparator_witness=comparator_witnessincludeStable_int63able.With_stable_witness.Swithtypet:=twithtypecomparator_witness:=comparator_witnessincludeComparable.Stable.V1.With_stable_witness.Swithtypecomparable:=twithtypecomparator_witness:=comparator_witnessincludeStringable.Swithtypet:=tendend(*_ See the Jane Street Style Guide for an explanation of [Private] submodules:
https://opensource.janestreet.com/standards/#private-submodules *)modulePrivate:sigvalof_parts:Parts.t->tvalto_parts:t->Parts.tendendmoduletypeOfday=sigmoduleSpan:Span(** [t] is immediate on 64bit boxes and so plays nicely with the GC write barrier. *)typet=privateInt63.t(** String and sexp output takes the form 'HH:MM:SS.sssssssss'; see
{!Core.Ofday_intf} for accepted input. If input includes more than 9 decimal
places in seconds, rounds to the nearest nanosecond, with the midpoint rounded up.
Allows 60[.sss...] seconds for leap seconds but treats it as exactly 60s regardless
of fractional part. *)includeOfday_intf.Swithtypeunderlying=Int63.tandtypet:=tandmoduleSpan:=Span(** The largest representable value below [start_of_next_day], i.e. one nanosecond
before midnight. *)valapproximate_end_of_day:t(*_ This is already exported from [Ofday_intf.S], but we re-declare it to add
documentation. *)(** [add_exn t span] shifts the time of day [t] by [span]. It raises if the result is
not in the same 24-hour day. Daylight savings shifts are not accounted for. *)valadd_exn:t->Span.t->t(** [sub_exn t span] shifts the time of day [t] back by [span]. It raises if the result
is not in the same 24-hour day. Daylight savings shifts are not accounted for. *)valsub_exn:t->Span.t->t(** [every span ~start ~stop] returns a sorted list of all [t]s that can be expressed as
[start + (i * span)] without overflow, and satisfying [t >= start && t <= stop].
If [span <= Span.zero || start > stop], returns an Error.
The result never crosses the midnight boundary. Constructing a list crossing
midnight, e.g. every hour from 10pm to 2am, requires multiple calls to [every]. *)valevery:Span.t->start:t->stop:t->tlistOr_error.tvalto_microsecond_string:t->stringvalarg_type:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valnow:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valof_ofday_float_round_nearest:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valof_ofday_float_round_nearest_microsecond:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valto_ofday_float_round_nearest:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valto_ofday_float_round_nearest_microsecond:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleOption:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleZoned:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]end(** Time represented as an [Int63.t] number of nanoseconds since the epoch.
See {!Time_ns_unix} for important user documentation.
Internally, arithmetic is not overflow-checked. Instead, overflows are silently
ignored as for [int] arithmetic, unless specifically documented otherwise. Conversions
may (or may not) raise if prior arithmetic operations overflowed. *)moduletypeTime_ns=sigmoduleSpan:SpanmoduleOfday:OfdaywithmoduleSpan:=Spantypet=privateInt63.t[@@derivinghash,typerep,bin_io]includeComparisons.Swithtypet:=t(** Note that we expose a sexp format that is not the one exposed in [Core]. *)moduleAlternate_sexp:sigtypenonrect=t[@@derivingcompare,equal,hash,sexp,sexp_grammar]includeComparable.Swithtypet:=tendincludeTime_intf.Sharedwithtypet:=twithmoduleSpan:=SpanwithmoduleOfday:=Ofdayvalof_string:string->t[@@deprecated"[since 2021-04] Use [of_string_with_utc_offset] or [Time_ns_unix.of_string]"](** [of_string_with_utc_offset] requires its input to have an explicit
UTC offset, e.g. [2000-01-01 12:34:56.789012-23], or use the UTC zone, "Z",
e.g. [2000-01-01 12:34:56.789012Z]. *)valof_string_with_utc_offset:string->tvalto_string:t->string[@@deprecated"[since 2021-04] Use [to_string_utc] or [Time_ns_unix.to_string]"](** [to_string_utc] generates a time string with the UTC zone, "Z", e.g. [2000-01-01
12:34:56.789012Z]. *)valto_string_utc:t->string(** Unix epoch (1970-01-01 00:00:00 UTC) *)valepoch:t(** The minimum representable time. *)valmin_value_representable:t(** The maximum representable time. *)valmax_value_representable:t(** The minimum time that rounds to a [Time.t] with microsecond precision. *)valmin_value_for_1us_rounding:t(** The maximum time that rounds to a [Time.t] with microsecond precision. *)valmax_value_for_1us_rounding:t(** An alias for [min_value_for_1us_rounding]. *)valmin_value:t[@@deprecated"[since 2019-02] use [min_value_representable] or [min_value_for_1us_rounding] \
instead"](** An alias for [max_value_for_1us_rounding]. *)valmax_value:t[@@deprecated"[since 2019-02] use [max_value_representable] or [max_value_for_1us_rounding] \
instead"](** The current time. *)valnow:unit->t(** overflows silently *)valadd:t->Span.t->t(** As [add]; rather than over/underflowing, clamps the result to the closed interval
between [min_value_representable] and [max_value_representable]. *)valadd_saturating:t->Span.t->t(** As [sub]; rather than over/underflowing, clamps the result to the closed interval
between [min_value_representable] and [max_value_representable]. *)valsub_saturating:t->Span.t->t(** overflows silently *)valsub:t->Span.t->t(** overflows silently *)valnext:t->t(** overflows silently *)valprev:t->t(** overflows silently *)valdiff:t->t->Span.t(** overflows silently *)valabs_diff:t->t->Span.tvalto_span_since_epoch:t->Span.tvalof_span_since_epoch:Span.t->tvalto_int63_ns_since_epoch:t->Int63.tvalof_int63_ns_since_epoch:Int63.t->t(** Will raise on 32-bit platforms. Consider [to_int63_ns_since_epoch] instead. *)valto_int_ns_since_epoch:t->intvalof_int_ns_since_epoch:int->t(** [next_multiple ~base ~after ~interval] returns the smallest [time] of the form:
{[
time = base + k * interval
]}
where [k >= 0] and [time > after]. It is an error if [interval <= 0].
Supplying [~can_equal_after:true] allows the result to satisfy [time >= after].
Overflows silently. *)valnext_multiple:?can_equal_after:bool(** default is [false] *)->base:t->after:t->interval:Span.t->unit->t(** [prev_multiple ~base ~before ~interval] returns the largest [time] of the form:
{[
time = base + k * interval
]}
where [k >= 0] and [time < before]. It is an error if [interval <= 0].
Supplying [~can_equal_before:true] allows the result to satisfy [time <= before].
*)valprev_multiple:?can_equal_before:bool(** default is [false] *)->base:t->before:t->interval:Span.t->unit->tvalrandom:?state:Random.State.t->unit->tvalof_time:Time_float.t->t[@@deprecated"[since 2019-01] use [of_time_float_round_nearest] or \
[of_time_float_round_nearest_microsecond]"]valto_time:t->Time_float.t[@@deprecated"[since 2019-01] use [to_time_float_round_nearest] or \
[to_time_float_round_nearest_microsecond]"](** [*_round_nearest] vs [*_round_nearest_microsecond]: If you don't know that you need
microsecond precision, use the [*_round_nearest] version.
[*_round_nearest_microsecond] is for historical purposes. *)valto_time_float_round_nearest:t->Time_float.tvalto_time_float_round_nearest_microsecond:t->Time_float.tvalof_time_float_round_nearest:Time_float.t->tvalof_time_float_round_nearest_microsecond:Time_float.t->tmoduleUtc:sig(** [to_date_and_span_since_start_of_day] computes the date and intraday-offset of a
time in UTC. It may be slower than [Core.Time_ns.to_date_ofday], as this
function does not cache partial results while the latter does. *)valto_date_and_span_since_start_of_day:t->Date0.t*Span.t(** The inverse of [to_date_and_span_since_start_of_day]. *)valof_date_and_span_since_start_of_day:Date0.t->Span.t->tendmoduleStable:sigmoduleV1:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix] or [Time_ns.Alternate_sexp]"]moduleOption:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleAlternate_sexp:sigmoduleV1:sigtypet=Alternate_sexp.t[@@derivingbin_io,compare,hash,sexp,sexp_grammar,stable_witness]includeComparator.Stable.V1.Swithtypet:=tandtypecomparator_witness=Alternate_sexp.comparator_witnessincludeComparable.Stable.V1.With_stable_witness.Swithtypecomparable:=twithtypecomparator_witness:=comparator_witnessendendmoduleSpan:sigmoduleV1:sigtypenonrect=Span.t[@@derivinghash,equal]includeStable_int63able.With_stable_witness.Swithtypet:=tendmoduleOption:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleV2:sigtypet=Span.t[@@derivinghash,equal,sexp_grammar]typenonreccomparator_witness=Span.comparator_witnessincludeStable_int63able.With_stable_witness.Swithtypet:=twithtypecomparator_witness:=comparator_witnessincludeComparable.Stable.V1.With_stable_witness.Swithtypecomparable:=twithtypecomparator_witness:=comparator_witnessincludeStringable.Swithtypet:=tendendmoduleOfday:sigmoduleV1:sigtypet=Ofday.t[@@derivingequal,hash]includeStable_int63able.With_stable_witness.Swithtypet:=tandtypecomparator_witness=Ofday.comparator_witnessendmoduleOption:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleZoned:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]endendmoduleHash_queue:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleHash_set:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleMap:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleOption:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleReplace_polymorphic_compare:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleSet:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleTable:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]moduleZone:sigend[@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valarg_type:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valcomparator:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valget_sexp_zone:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valinterruptible_pause:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valof_date_ofday_zoned:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valof_string_abs:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valof_string_fix_proto:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valpause:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valpause_forever:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valpp:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valset_sexp_zone:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valsexp_of_t:[`Use_Time_ns_unix_or_Time_ns_alternate_sexp][@@deprecated"[since 2021-03] Use [Time_ns_unix] or [Time_ns.Alternate_sexp]"]valsexp_of_t_abs:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valt_of_sexp:[`Use_Time_ns_unix_or_Time_ns_alternate_sexp][@@deprecated"[since 2021-03] Use [Time_ns_unix] or [Time_ns.Alternate_sexp]"]valt_of_sexp_abs:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valto_date_ofday_zoned:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valto_ofday_zoned:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valto_string_fix_proto:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valvalidate_bound:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valvalidate_lbound:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]valvalidate_ubound:[`Use_Time_ns_unix][@@deprecated"[since 2021-03] Use [Time_ns_unix]"]end