Liking cljdoc? Tell your friends :D

hive-ttracking.time.zone

The zone seam: the ONE place the library touches the platform.

Every other namespace is pure. Here lives the bridge between a Day and an instant, and it is a FUNCTION OF A LIBRARY, never a field of a Day.

The zone is ALWAYS an explicit argument: ttrack has NO default zone. A library that silently reaches for America/Sao_Paulo is exactly the coupling this coordinate was carved out to break.

The two rules the dst-* rows fix, on BOTH legs:

  • a gap (DST start) is an EXPLICIT error (:time/zone-gap), never a silent shift of the wall clock;
  • in an overlap (DST end) the EARLIEST offset wins, deterministically (java.time's default; the cljs two-candidate search's min).

clj leg: java.time ZoneId / LocalDateTime with getValidOffsets. cljs leg: Intl.DateTimeFormat with formatToParts, hourCycle h23, cached per zone in a js/Map, plus a two-candidate offset search. NO tz library -- the zone rules come from the engine's ICU tzdata.

Map keys are the generic English names (:year :month :day, :hour :minute :second, :start :end).

The zone seam: the ONE place the library touches the platform.

Every other namespace is pure. Here lives the bridge between a Day and an
instant, and it is a FUNCTION OF A LIBRARY, never a field of a Day.

The zone is ALWAYS an explicit argument: ttrack has NO default zone. A
library that silently reaches for America/Sao_Paulo is exactly the coupling
this coordinate was carved out to break.

The two rules the dst-* rows fix, on BOTH legs:
  - a gap (DST start) is an EXPLICIT error (:time/zone-gap), never a silent
    shift of the wall clock;
  - in an overlap (DST end) the EARLIEST offset wins, deterministically
    (java.time's default; the cljs two-candidate search's min).

clj leg: java.time ZoneId / LocalDateTime with getValidOffsets.
cljs leg: Intl.DateTimeFormat with formatToParts, hourCycle h23, cached per
zone in a js/Map, plus a two-candidate offset search. NO tz library -- the
zone rules come from the engine's ICU tzdata.

Map keys are the generic English names (:year :month :day, :hour :minute
:second, :start :end).
raw docstring

->zoneclj/s

(->zone zone)

Validating constructor: an IANA zone id -> the ZoneId. A non-string, an empty string, or an id the platform does not know -> :time/zone-unknown.

The ZoneId IS the id string; the platform handle is derived on each call and never stored in a value, so a value is comparable and serialisable.

Validating constructor: an IANA zone id -> the ZoneId. A non-string, an empty
string, or an id the platform does not know -> :time/zone-unknown.

The ZoneId IS the id string; the platform handle is derived on each call and
never stored in a value, so a value is comparable and serialisable.
sourceraw docstring

day->instantclj/s

(day->instant d zone)

The op-table name for day-start: the instant a Day begins in a zone.

The op-table name for `day-start`: the instant a Day begins in a zone.
sourceraw docstring

day-startclj/s

(day-start d zone)

The first instant of day in zone (= atStartOfDay).

On a DST-gap day 00:00 never happened: the instant is 00:00 read in the offset BEFORE the transition, so America/Sao_Paulo 2018-11-04 -> 03:00Z. It never refuses -- a day always begins somewhere.

The first instant of `day` in `zone` (= atStartOfDay).

On a DST-gap day 00:00 never happened: the instant is 00:00 read in the
offset BEFORE the transition, so America/Sao_Paulo 2018-11-04 -> 03:00Z. It
never refuses -- a day always begins somewhere.
sourceraw docstring

instant->dayclj/s

(instant->day instant zone)

The Day of instant in zone. The ZONE is the argument, never a field of the value -- that is the whole correction.

The Day of `instant` in `zone`. The ZONE is the argument, never a field of
the value -- that is the whole correction.
sourceraw docstring

instant->localclj/s

(instant->local instant zone)

The wall clock of instant in zone: {:day Day :time TimeOfDay}.

The wall clock of `instant` in `zone`: {:day Day :time TimeOfDay}.
sourceraw docstring

Localclj/s

The wall-clock value object (instant->local) as a CLOSED malli map wrapped in its invariant: {:day Day :time TimeOfDay}.

The wall-clock value object (instant->local) as a CLOSED malli map wrapped in
its invariant: {:day Day :time TimeOfDay}.
sourceraw docstring

local->instantclj/s

(local->instant d h zone)

The instant of a wall clock (a Day + a TimeOfDay) in zone.

The gap/overlap policy is EXPLICIT, never a silent shift:

  • a gap (the wall clock never happened, DST start) -> :time/zone-gap;
  • an overlap (the wall clock happened twice, DST end) -> the EARLIEST offset, deterministically.
The instant of a wall clock (a Day + a TimeOfDay) in `zone`.

The gap/overlap policy is EXPLICIT, never a silent shift:
  - a gap (the wall clock never happened, DST start) -> :time/zone-gap;
  - an overlap (the wall clock happened twice, DST end) -> the EARLIEST
    offset, deterministically.
sourceraw docstring

local-time->instantclj/s

(local-time->instant d h zone)

The op-table name for local->instant: a local Day + TimeOfDay in a zone -> epoch ms; a gap -> :time/zone-gap, an overlap -> the earliest offset.

The op-table name for `local->instant`: a local Day + TimeOfDay in a zone ->
epoch ms; a gap -> :time/zone-gap, an overlap -> the earliest offset.
sourceraw docstring

local?clj/s

(local? x)

True when x is a wall clock: a valid Day and a valid TimeOfDay. Never throws.

True when `x` is a wall clock: a valid Day and a valid TimeOfDay. Never
throws.
sourceraw docstring

offset-msclj/s

(offset-ms instant zone)

The zone offset at instant, in ms: wall-clock-as-UTC-ms - instant.

The zone offset at `instant`, in ms: wall-clock-as-UTC-ms - instant.
sourceraw docstring

period->instant-intervalclj/s

(period->instant-interval p zone)

A Period as a HALF-OPEN interval of instants [start@00:00, (end+1)@00:00) in zone. Never +86400 s, never 23:59:59. The period is validated first: a missing end -> :time/period-missing-bound, start > end -> :time/period-inverted.

A Period as a HALF-OPEN interval of instants [start@00:00, (end+1)@00:00) in
`zone`. Never +86400 s, never 23:59:59. The period is validated first: a
missing end -> :time/period-missing-bound, start > end ->
:time/period-inverted.
sourceraw docstring

period-contains-instant?clj/s

(period-contains-instant? p zone t)

a <= t < b.

a <= t < b.
sourceraw docstring

Zoneclj/s

The ZoneId value object as a malli schema. A zone id is a STRING, so there is no closed map to wrap: the schema is the base type wrapped in the invariant (zone?), never shape-only. Step-8's schema.cljc re-exports this.

The ZoneId value object as a malli schema. A zone id is a STRING, so there is
no closed map to wrap: the schema is the base type wrapped in the invariant
(zone?), never shape-only. Step-8's schema.cljc re-exports this.
sourceraw docstring

zone?clj/s

(zone? zone)

True when zone is a usable zone id on this platform. Never throws.

True when `zone` is a usable zone id on this platform. Never throws.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close