Time, Date, Duration#

The temporal types (Time, Date, Duration), the builtins that operate on them, and the integrator-owned timezone-resolution contract.

Duration values are time-dimensioned unit literals — 1_h, 30_min, 500_ms — with no separate duration-literal token. This doc formalises the Duration type and the rest of the temporal surface.

Paired with:

  • [LSTR] for t.to_string(format).

  • [LDET] for the engine-controlled now() clock.

  • [LLEX] for duration-literal lexing.

  • [LADP] for adapter wire- format obligations.

What this is not#

  • Not a calendar library. Operations beyond the listed surface (business-day arithmetic, holiday awareness, timezone database, period-of-day calculations) are out of scope.

  • Not a tzdata bundle. libds carries no timezone database; the integrator owns resolution per [LTIM.10].

  • Not a parser. DS writes temporal values as text and reads none: a host or an adapter delivers them typed ([LTIM.11.2]), and the calendar module builds them from integer fields ([LTIM.14]).


Types [LTIM.1]#

Time [LTIM.1.1]#

[LTIM.1.1.1] A Time value is a fully-specified point in time:

(utc_ns: Int64, tz_offset_ns: Int64)

Two logical Int64 nanosecond components. Authors see exactly this model; ordering, equality and arithmetic operate on utc_ns alone. The offset is always a whole number of seconds ([LTIM.3.2.2]); how a runtime stores it is its own.

ratified — see also: LTIM.3.2.2

[LTIM.1.1.2] utc_ns is nanoseconds since the Unix epoch in UTC. Arithmetic and comparison must operate on this component; tz_offset_ns does not affect ordering or duration computation.

[LTIM.1.1.3] tz_offset_ns is nanoseconds east of UTC, resolved by the local member ([LTIM.3.2.1]); a Time the engine builds or reads from a slot has offset 0 ([LTIM.14.1]). Once resolved, it is fixed for the lifetime of the value within an expression. The value model carries it as an Int64 nanosecond quantity (a seconds-or-finer offset in ns exceeds Int32). Local-time computation (utc_ns + tz_offset_ns) is a same-unit add — no seconds-to-nanoseconds conversion in the arithmetic.

A Time stored in a fact slot persists the utc_ns instant only; the resolved offset is an expression-time property and is not persisted in working memory. A Time written to a slot and read back therefore comes back UTC (tz_offset_ns = 0); re-zone it with local at use.

ratified — see also: LTIM.14.1, LTIM.3.2.1

[LTIM.1.1.5] Nanosecond precision is normative. Both components of the Time value model carry Int64 nanosecond precision. The representable range is approximately ±292 years from the Unix epoch (calendar ≈ 1678–2262), which the runtime must treat as the representable Time range. A Time outside it is never a silent wrap. A host call that would admit one returns DS_ERR_TIME_RANGE; an operation in a rule whose result falls outside it raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]). Precision and range are properties of the value model.

ratified — see also: LERR.1.4.10

Date [LTIM.1.2]#

[LTIM.1.2.1] A Date value is a Gregorian calendar date with no time-of-day and no timezone. Its components:

Component

Width

year

32-bit signed integer

month

8-bit signed integer

day

8-bit signed integer

[LTIM.1.2.2] year is the full Gregorian year (2024, not '24 or 124).

A Date has the range of a Time. A Date is one of the days whose midnight in UTC is a representable Time ([LTIM.1.1.5]): 1677-09-22 through 2262-04-11, the day counts −106 751 through 106 751 from 1970-01-01 ([LTIM.6.6]). A Date outside that range is never a silent wrap. A host call that would admit one returns DS_ERR_TIME_RANGE; an operation in a rule whose result falls outside it raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]).

ratified — see also: LERR.1.4.10, LTIM.1.1.5, LTIM.6.6

[LTIM.1.2.3] month is in 1..12. 0..11 (the C / JavaScript convention) is not admitted.

[LTIM.1.2.4] day is in 1..31, valid for the given month and year: every Date names a day of the proleptic Gregorian calendar. calendar.date refuses fields that name no such day ([LTIM.14.2]), and calendar arithmetic that lands past a month's end clamps to its last day ([LTIM.4.3.2]).

see also: LTIM.14.2, LTIM.4.3.2

[LTIM.1.2.5] Date admits no timezone annotation; a date with a timezone is conceptually a half-resolved Time and authors who need that combination construct a Time directly.

Duration [LTIM.1.3]#

[LTIM.1.3.1] A Duration is a magnitude: it is never negative. It is stored as nanoseconds (int64), matching the time unit dimension's storage type. Wherever a Duration would be formed with a negative number of nanoseconds, the compiler and the runtime must form 0_s instead:

  • by arithmetic: [LTIM.4.1.1]'s Duration-valued rows, and Date - Date ([LTIM.4.2.3]);

  • by a conversion: a negative Int cast to a time unit ([LCST.4.5.2]);

  • at the boundary: a negative value a host asserts into a slot of the time dimension ([LTIM.1.3.5], [NFCT.2.3]).

Saturation is the rule, not a fault. An event clock carries adapter timestamps, and clock skew must not turn now() - r.ts into a stream of faults. At the top of the range a Duration-valued row raises rather than saturates ([LTIM.4.1.1]). No unary - applies to a Duration ([LEXP.7.10]), and its text form has no sign ([LTIM.8.4.2]).

Order is asked of the instants, and a signed difference is an Int. a < b and a > b say which of two instants is earlier. The signed number of nanoseconds from b to a is (a - b)::Int - (b - a)::Int ([LCST.4.5.2]), because one of the two differences is 0_s.

ratified — see also: LCST.4.5.2, LEXP.7.10, LTIM.1.3.5, LTIM.4.1.1, LTIM.4.2.3, LTIM.8.4.2, NFCT.2.3

[LTIM.1.3.2] Duration values are produced by time-dimensioned unit literals (1_h, 30_min, 500_ms) per [LLEX.12]. A unary minus on one is refused ([LUNI.3.3]).

see also: LLEX.12, LUNI.3.3

[LTIM.1.3.5] A Duration is a value of the time dimension. Duration is the one static type of every value of that dimension: a time-dimensioned unit literal, a slot or service kwarg typed by a time unit or by time ([LUNI.7.1]), a ::<time unit> cast, and each Duration-valued row of [LTIM.4.1.1]. The compiler must type them alike, so [LTIM.4.1] and the rules of [LUNI.8] reach each of them, and must not type a value of the dimension as a Float, or as an Int with a dimension.

The time unit declared on a slot or a kwarg says how the value displays ([LUNI.11.1]) and how it is delivered ([LADP.8.5]), and names no other type. The compiler must refuse a bitwise operator on a Duration with DS_VALIDATE_BITWISE_TYPE ([LEXP.7.7]).

ratified — see also: LADP.8.5, LEXP.7.7, LTIM.4.1, LTIM.4.1.1, LUNI.11.1, LUNI.7.1, LUNI.8

[LTIM.1.3.3] Duration arises from Time - Time, Date - Date, and duration arithmetic.

[LTIM.1.3.4] Duration carries no timezone. Subtracting two Time values in different timezones produces the same Duration regardless of the operands' offsets.


now() and monotonic_ns() [LTIM.2]#

now() → Time [LTIM.2.1]#

[LTIM.2.1.1] now() returns the wall-clock UTC instant as a Time with tz_offset_ns = 0. The runtime must populate utc_ns from the wall clock's current sample ([LTIM.2.8.3], [LTIM.2.8.4]) at full nanosecond width; it must not truncate to microseconds. now() makes no monotonicity promise: a later sample may be earlier.

ratified — checks: tla idris×3 — see also: LTIM.2.8.3, LTIM.2.8.4

[LTIM.2.1.2] The runtime must drive now() from the engine's wall clock ([LTIM.2.8.3]), never from a platform clock read directly. Both engine clocks are mockable via test harness controls: clock_set and clock_advance move the monotonic clock, clock_advance moves the wall clock by the same interval, and wall_clock_set sets the wall clock alone ([LTES.3.2.2]).

ratified — checks: idris×3 — see also: LTES.3.2.2, LTIM.2.8.3

[LTIM.2.1.3] Two calls to now() within one rule activation must return the same value. Activations are atomic with respect to the clock: the engine samples only between steps ([LTIM.2.8.4]), never within an activation.

see also: LTIM.2.8.4

monotonic_ns() → Duration [LTIM.2.2]#

[LTIM.2.2.1] monotonic_ns() returns the monotonic clock's current sample ([LTIM.2.8.2], [LTIM.2.8.4]) as a Duration. A later read never returns less than an earlier one. The value's zero is unspecified, so only the difference of two reads is meaningful. The runtime must not scale a microsecond reading into the Duration — the Duration is already nanoseconds ([LTIM.1.3.1]).

checks: tla — see also: LTIM.1.3.1, LTIM.2.8.2, LTIM.2.8.4

[LTIM.2.2.2] monotonic_ns() reads the same clock the engine's relative-time mechanisms read ([LTIM.2.8.2]). An author measures elapsed time with a difference of monotonic_ns() reads, or with dwell, and reads calendar time with now().

see also: LTIM.2.8.2

[LTIM.2.3] The nanosecond unit of now() and monotonic_ns() is a storage and arithmetic contract, not an accuracy guarantee. Effective clock resolution is platform-bounded — a microsecond-class host yields Time/Duration values whose low digits are zero — and a conforming runtime may surface only the resolution its platform clock provides. Authors must not infer event ordering from sub-microsecond differences in time values; the stream seq is the ordering authority ([LFST.5.3]).

see also: LFST.5.3

Clock-driven re-evaluation [LTIM.2.4]#

[LTIM.2.4.1] A where-condition is time-dependent when its truth value can change from one pump to the next with no change to the matched facts. Three reads make it so:

  • a clock read: now() or monotonic_ns(), directly or via the dwell alias of [LEXP.9.5];

  • a series read: an aggregation of [LSER.16] over a series, written as a call or as a companion slot ([LSER.6.3]). Its value moves as the series absorbs other facts' samples at the end of each pump ([LSER.8.6]), and, over a window, as the clock moves ([LSER.8.8.1]);

  • a zone read: the resolution of any zone but UTC ([LTIM.10.7], [LTIM.10.8]), by any operation [LTIM.10.3] lists. Its answer moves as the host asserts, replaces or retracts TimeZoneOffset facts ([LTIM.10.6]).

ratified — checks: tla×4 idris×30 — see also: LEXP.9.5, LSER.16, LSER.6.3, LSER.8.6, LSER.8.8.1, LTIM.10.3, LTIM.10.6, LTIM.10.7, LTIM.10.8

[LTIM.2.4.2] The runtime must re-evaluate a time-dependent condition on every engine tick (each pump), not only when a matched fact is asserted or a new left token arrives. A rule whose only unmet gate is a time-dependent condition must therefore fire once the clock advances to satisfy it, with no intervening fact activity.

A rate modifier on the rule does not exempt it. The activation key a cooldown gates on is built from the rule's own positive patterns ([LCDB.3.3.3], [LCDB.3.3.4]), and the engine-synthesised fact that drives the tick is not one of them ([LDET.5.8]), so re-evaluating the rule on every tick does not change its key.

ratified — checks: tla×7 idris×51 — see also: LCDB.3.3.3, LCDB.3.3.4, LDET.5.8

[LTIM.2.4.3] Re-evaluation reads both clocks as sampled when the pump began ([LTIM.2.8.4]), and every series as it stood when the pump began ([LSER.8.6.1]); all now() reads within one activation are still atomic ([LTIM.2.1.3]).

ratified — checks: idris×9 — see also: LSER.8.6.1, LTIM.2.1.3, LTIM.2.8.4

Edge-triggered firing of time-dependent rules [LTIM.2.5]#

checks: tla×6

[LTIM.2.5.1] A rule gated on a time-dependent condition must fire once per false → true edge of the condition for a given matched fact wrapper, on the pump at which the edge occurs, and must not re-fire on subsequent pumps while the condition remains true. This edge-once behaviour is a consequence of refraction ([LDET.5.3]) with [LDET.5.8]: a clock tick is not a change to the LHS, so a fired activation stays refracted across pumps for as long as its match persists.

A pump that ends at a firing limit leaves the activation unfired; it fires on a later pump if its match persists until then.

A condition that closes ends the match, and a reopening is a new edge. When the condition goes true → false, the match ends and its activation with it, as a within window's does ([LTIM.2.7.2]); no memory of the firing outlives the activation. When the condition goes false → true again for the same wrapper, the new match fires. A gate that stays true once true fires once per wrapper; a window that shuts and reopens, or a now() gate the wall clock crosses back and forth ([LTIM.2.8.3]), fires once per opening.

ratified — checks: tla×11 idris×74 — see also: LDET.5.3, LDET.5.8, LTIM.2.7.2, LTIM.2.8.3

[LTIM.2.5.2] Besides a new false → true edge on the same wrapper ([LTIM.2.5.1]), the firing re-arms on a new fact wrapper (fact_id), not the identity key ([LFAC.1.7]): a meaningful change to the matched fact mints a new wrapper via retract+assert ([LFAC.2.5.3] / [LFAC.1.2.2]), and that new wrapper re-arms and may fire again once the condition holds for it. Both an identity-key change and a mutable-slot update re-arm — each mints a new wrapper. A no-op reassertion preserves the wrapper and does not re-arm. A retracted fact that later re-matches likewise re-arms (new wrapper).

ratified — checks: tla×5 idris — see also: LFAC.1.2.2, LFAC.1.7, LFAC.2.5.3, LTIM.2.5.1

[LTIM.2.5.3] A time-dependent condition that is already true when its fact is asserted fires on the next pump, if it still holds under that pump's sample ([LTIM.2.4.3]). [LTIM.2.4] / [LTIM.2.5] add re-evaluation on later ticks; they do not delay a condition already satisfied when the fact arrives. A condition the pump's sample finds false has ended its match ([LTIM.2.5.1]), and nothing fires.

ratified — checks: idris×5 — see also: LTIM.2.4, LTIM.2.4.3, LTIM.2.5, LTIM.2.5.1

[LTIM.2.5.4] When a rule carries both a time-dependent gate and a cooldown ([LCDB.3.2.1]), the maturity gate ([LTIM.2.5]) and the rate gate compose by conjunction: the rule fires when the condition first holds and the rate window permits. The rate gate remains RHS-level and stateful; the maturity gate is a stateless pre-fire test.

checks: idris×25 — see also: LCDB.3.2.1, LTIM.2.5

Multi-pattern time-dependent conditions [LTIM.2.6]#

[LTIM.2.6.1] In v1 the re-evaluation guarantee of [LTIM.2.4] is defined for a rule with a single positive pattern carrying the time-dependent condition.

checks: idris×4 — see also: LTIM.2.4

[LTIM.2.6.2] A time-dependent condition on a rule with more than one positive pattern is a compile error DS_VALIDATE_NOW_MULTIPATTERN_UNSUPPORTED rather than a silently non-re-evaluating rule. Both kinds count: a where that makes any time-dependent read, a clock, a series or a zone read ([LTIM.2.4.1]), and a positive pattern's within window ([LTIM.2.7.1]). A then … within step does not: its window compares two facts' ts values ([RLOW.5.6.1]) and reads no clock. A cache read is not time-dependent, and [LEXP.9.6.1] refuses it under its own code.

The compiler counts t.local(tz) and t.date(tz) ([LTIM.10.3]) as a zone read unless tz folds to "UTC" ([LTIM.10.8]): a literal, or a const whose folded value it is ([LGRA.4.1]). A designation it cannot fold may name any zone when the rule runs, so it counts, whatever it holds.

ratified — see also: LEXP.9.6.1, LGRA.4.1, LTIM.10.3, LTIM.10.8, LTIM.2.4.1, LTIM.2.7.1, RLOW.5.6.1

within-window recency [LTIM.2.7]#

[LTIM.2.7.1] A positive pattern carrying a within <dur> recency window is time-dependent per [LTIM.2.4.1]: the fact matches only while the monotonic clock's sample is less than <dur> past the fact's entry stamp ([LTIM.2.8.6]), and that truth changes as the clock advances with no fact activity. It is re-evaluated on every tick under [LTIM.2.4].

A within takes a positive duration. A pattern's within_clause ([LGRA.8.1]) whose duration is not positive is a compile error (DS_VALIDATE_ZERO_WITHIN), whether the duration is written as a duration literal or as a time const ([LGRA.2.8.1]), and whether the pattern is positive or negated. On a positive pattern a zero window admits no fact, since no fact is less than zero past its entry stamp, so the pattern never matches. Under no it blocks on nothing, so the condition always holds. A then step's window is refused the same way ([LTHE.4.7]).

ratified — checks: idris×8 — see also: LGRA.2.8.1, LGRA.8.1, LTHE.4.7, LTIM.2.4, LTIM.2.4.1, LTIM.2.8.6

[LTIM.2.7.3] A window may not outlast the facts it reads. A window sees a fact only while the fact is in working memory ([LTIM.2.7.1]), so it sees no fact older than the longest any fact of its schema can live. A window longer than that states a past the engine does not hold. The compiler must refuse it with DS_VALIDATE_WITHIN_EXCEEDS_TTL:

  • a pattern's within, positive or negated, whose duration exceeds its schema's TTL ([LGRA.5.2]);

  • a then step's within whose duration exceeds the TTL of the step before it ([LTHE.2.3.1]), whose fact must still be live when the step's fact arrives.

A window equal to the TTL is not refused. A schema of another lifecycle has no TTL and bounds no window. Where dynamic_ttl is on, retain: may give a fact any lifetime ([LDTL.4.1]), so no window is refused under this clause.

ratified — see also: LDTL.4.1, LGRA.5.2, LTHE.2.3.1, LTIM.2.7.1

[LTIM.2.7.2] When a within-windowed positive pattern justifies a logical fact ([LLOG]), the justification lapses as the window expires: on the pump at which the matched fact falls outside <dur>, the pattern no longer matches and the engine must retract the justified logical fact — truth maintenance per the justification-linkage principle ([LLOG.15.1]) — emitting fact_retract.

ratified — checks: idris×9 — see also: LLOG.15.1

The engine's two clocks [LTIM.2.8]#

[LTIM.2.8.1] The engine holds two clocks, the monotonic clock ([LTIM.2.8.2]) and the wall clock ([LTIM.2.8.3]). Both read in integer nanoseconds, and both are inputs to the engine: the engine must not read a platform clock except through its clock source or to measure pump_wcet_ns ([RTCT.7.3]), and must record every value either clock yields ([LTIM.2.8.5]).

The pump_wcet_ns measurement ([RTCT.7.3]) is not a read of either engine clock: no expression sees it, and the trace carries only the fault it raises.

checks: tla idris×6 — see also: LTIM.2.8.2, LTIM.2.8.3, LTIM.2.8.5, RTCT.7.3

[LTIM.2.8.2] The monotonic clock never decreases. Its zero is unspecified: only the difference between two of its readings has a meaning, and the runtime must not give a single reading any other (process uptime, time since engine creation, a calendar instant).

Its range is the Duration range ([LTIM.1.3.1]): 0 to $2^{63} - 1$ nanoseconds. A host call that would move it past the top returns DS_ERR_TIME_RANGE ([NTST.3.1], [LTIM.1.1.5]). The runtime must hold a live reading past the top at the top ([NLFC.5.4]), so the clock neither wraps nor decreases.

Every relative-time mechanism must read the monotonic clock and no other: TTL expiry, after, a call's timeout, cooldown, a single pattern's within, dwell and series windows. A change to the wall clock therefore moves none of them.

A sequence's within (then … within) is not one of them. It bounds when the events happened, not when the engine received them, so it compares the facts' own ts values ([LTHE.2.2.2]), which are event time.

ratified — checks: tla×7 idris×46 — see also: LTHE.2.2.2, LTIM.1.1.5, LTIM.1.3.1, NLFC.5.4, NTST.3.1

[LTIM.2.8.3] The wall clock reads UTC nanoseconds since the Unix epoch. It may jump forward or move backward between two samples — a host clock set by an operator or stepped by time synchronisation does both. It drives now() ([LTIM.2.1]) and the ts the engine fills ([LFAC.9.2]), and nothing else.

A condition reading now() observes the wall clock as it is: a gate such as a comparison of now() against a fixed instant can become false again when the wall clock moves backward across the instant, and true again when it moves forward ([LTIM.2.5.1]). An author who needs a gate that stays open once opened measures elapsed time on the monotonic clock instead — dwell, within, or a difference of monotonic_ns() readings.

The wall clock may have no value: a mock clock before the test sets it ([NLFC.5.4]), or a live clock on a host that supplies no wall-clock source. A now() read while it has none, or the engine filling a ts from it ([LFAC.9.2]), is a ComputationError of kind DOMAIN ([LERR.1.4.10]), and the engine continues. In a rule's activation (a now() read, an emit or a publish) the activation is abandoned and the rule does not fire. For an initial block's fact ([LGRA.24.3]) the fact is not placed. Once the wall clock has a value, now() reads it.

ratified — checks: tla×3 idris×34 — see also: LERR.1.4.10, LFAC.9.2, LGRA.24.3, LTIM.2.1, LTIM.2.5.1, NLFC.5.4

[LTIM.2.8.4] One sample per step. The engine must sample both clocks together when it consumes an input and when a pump begins, and must not read either clock at any other time. Every read between two samples — in a where condition, a re-evaluation, a let, an action — returns the most recent sample. Two reads of now(), or of monotonic_ns(), between the same two samples therefore return the same value, whatever order the engine evaluates the expressions containing them in and however many times it evaluates each.

checks: tla×20 idris×35

[LTIM.2.8.5] Both clocks are recorded. A sample in which either clock's value differs from the previous sample is an observed clock value, and the engine must record it on its event trace, both values together ([RFCS.10.3]). The first sample is an observed clock value. The engine must record a sample before it records the input or the pump boundary the sample was taken for. A replay restores both clocks from the recording ([RFCS.10.5]), so now(), monotonic_ns() and every relative-time mechanism read on replay exactly what they read when the trace was recorded ([LDET.1.1]).

A recording is complete only if the integrator attaches the stream callback before the engine's first input or sample. One attached later begins part-way through the run: its first event's seq is not 0 ([LFST.5.3]), and a replayer must refuse it with DS_ERR_FS_RECORDING_INCOMPLETE, because the inputs before it are not in it.

ratified — checks: tla×5 idris×13 — see also: LDET.1.1, LFST.5.3, RFCS.10.3, RFCS.10.5

[LTIM.2.8.6] The entry stamp. The engine must stamp each fact, when it enters working memory, with the monotonic clock's current sample: the fact's entry stamp. A fact replaced by retract-and-replace ([LFAC.1.2.2]) enters anew and takes a new stamp; a suppressed no-op reassertion ([LFAC.2.5.1]) does not enter and keeps its stamp. dwell ([LEXP.9.5.1]) and within ([LTIM.2.7.1]) measure from the entry stamp. It is engine state, not a slot: no slot a schema declares, ts included, is read by either.


checks: idris×43 — see also: LEXP.9.5.1, LFAC.1.2.2, LFAC.2.5.1, LTIM.2.7.1

Construction [LTIM.3]#

t.utc → Time [LTIM.3.1]#

[LTIM.3.1.1] t.utc, a member of Time ([LGRA.9.6.2]), returns (t.utc_ns, 0). The UTC component is unchanged; the offset is set to 0. No timezone- callback invocation is required.

see also: LGRA.9.6.2

t.local(tz: String) → Time [LTIM.3.2]#

[LTIM.3.2.1] t.local(tz), a member of Time ([LGRA.9.6.2]), resolves tz at t.utc_ns per [LTIM.10] and returns (t.utc_ns, resolved_offset_ns). The UTC component is unchanged.

ratified — see also: LGRA.9.6.2, LTIM.10

[LTIM.3.2.2] tz is a zone designation: exactly "UTC", which needs no fact ([LTIM.10.8]), or any other string, which the host's TimeZoneOffset facts resolve ([LTIM.10.7]). Resolution yields a fixed seconds offset valid at t.utc_ns; the runtime multiplies that offset by 1e9 to store tz_offset_ns on the resolved Time — a single lossless conversion at construction (a tz offset is never sub-second). The offset is as DST-correct as the facts the host supplies ([LTIM.10.10]).

see also: LTIM.10.10, LTIM.10.7, LTIM.10.8

[LTIM.3.2.3] Resolution failure is a hard error per [LTIM.10.5.1].

see also: LTIM.10.5.1

t.date(tz: String) → Date [LTIM.3.3]#

[LTIM.3.3.1] t.date(tz) returns the calendar date that the instant t.utc_ns falls on in the named timezone. The implementation resolves the zone per [LTIM.10] to determine the local offset, then computes the local year-month-day.

see also: LTIM.10

[LTIM.3.3.2] Authors avoid the bare t.date() form (no argument); a timezone-less local date is undefined. The compiler must reject t.date() as a missing-argument error.


ratified

Arithmetic [LTIM.4]#

Time–Duration arithmetic [LTIM.4.1]#

[LTIM.4.1.1] The runtime must support:

Expression

Result

Time - Time

Duration

Time + Duration

Time (tz_offset_ns of the LHS preserved)

Time - Duration

Time (tz_offset_ns of the LHS preserved)

Duration + Duration

Duration

Duration - Duration

Duration

Int * Duration, Duration * Int

Duration

Float * Duration, Duration * Float

Duration

Duration / Int, Duration // Int

Duration (integer division of nanoseconds)

Duration / Float, Duration // Float

Duration

Duration % Duration

Duration ([LUNI.8.1])

Duration / Duration

Float ([LUNI.8.1])

Duration // Duration

Int ([LUNI.8.1])

A Duration-valued row whose exact result in nanoseconds is negative yields 0_s ([LTIM.1.3.1]): Time - Time with the left operand the earlier, Duration - Duration with the right operand the larger, and a product or quotient with a negative number. How the compiler lowers the saturation is [RLOW.6.1.6].

A Duration-valued row with a Float operand takes the Float operation over the nanoseconds ([LEXP.7.3]) and rounds its result, ties to even, to a whole number of nanoseconds ([LEXP.3.2]). A non-finite result, or one outside Int, raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]). A zero divisor is [LEXP.7.15.1]'s. Every other pair of a Duration and a number or a Duration is [LUNI.8.3]'s or [LUNI.8.4]'s.

The runtime must evaluate Duration + Duration and a product of an Int and a Duration exactly. A result greater than $2^{63} - 1$ nanoseconds raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]), never a wrap.

The runtime must evaluate Time + Duration, Time - Duration and Time - Time exactly. A Time result outside the representable range raises as [LTIM.1.1.5] states. Time - Time saturates at any distance between its operands, and a result greater than $2^{63} - 1$ nanoseconds, which no Duration holds, raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]), never a wrap.

ratified — see also: LERR.1.4.10, LEXP.3.2, LEXP.7.15.1, LEXP.7.3, LTIM.1.1.5, LTIM.1.3.1, LUNI.8.1, LUNI.8.3, LUNI.8.4, RLOW.6.1.6

[LTIM.4.1.2] All arithmetic operates on utc_ns and the nanosecond magnitude of Duration. tz_offset_ns is preserved on Time + Duration and Time - Duration and has no effect on the result.

Date arithmetic [LTIM.4.2]#

[LTIM.4.2.1] The runtime must support:

Expression

Result

Date - Date

Duration (multiple of 24h)

Date + Duration (whole-day)

Date

Date - Duration (whole-day)

Date

[LTIM.4.2.2] Adding a Duration to a Date requires the duration to be a whole multiple of 24 hours. The compiler must reject a sub-day duration added to a Date with DS_VALIDATE_DATE_SUBDAY_ARITHMETIC: a Date has no time-of-day.

ratified

[LTIM.4.2.3] What Date arithmetic yields, and where it faults. The runtime must evaluate [LTIM.4.2.1]'s operations exactly, on the day count and the nanoseconds:

  • d + dur and d - dur are the Date dur / 86 400 · 10⁹ days after, or before, d. A dur that is not a whole number of days is refused at compile time where it is a literal ([LTIM.4.2.2]). Where it is known only at run time, the operation raises a ComputationError of kind DOMAIN ([LERR.1.4]).

  • a - b is the Duration of a's day count minus b's, times 86 400 · 10⁹ nanoseconds, and 0_s when a is the earlier ([LTIM.1.3.1]).

  • An operand or a result outside its type's range — a Date outside [LTIM.1.2.2]'s, or a Duration past 64-bit nanoseconds — raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]), never a wrap.

  • A null operand yields null ([LNUL.4.1]).

Where more than one of these applies, the first in this order decides: a null operand yields null; then a dur that is not a whole number of days raises DOMAIN; then a value outside its range raises NOT_REPRESENTABLE.

ratified — see also: LERR.1.4, LERR.1.4.10, LNUL.4.1, LTIM.1.2.2, LTIM.1.3.1, LTIM.4.2.1, LTIM.4.2.2

Calendar arithmetic [LTIM.4.3]#

[LTIM.4.3.1] The runtime must provide these members of Time and Date ([LGRA.9.6.2]):

t.add_months(n: Int) → Time
d.add_months(n: Int) → Date
t.add_years(n: Int)  → Time
d.add_years(n: Int)  → Date

ratified — see also: LGRA.9.6.2

[LTIM.4.3.2] When the original day-of-month is invalid in the target month, the result must clamp to the last valid day of the target month. One month added to 2024-03-31 is 2024-04-30, not 2024-05-01 and not an error.

ratified

[LTIM.4.3.3] add_months and add_years on a Time shift the calendar date in UTC and preserve the UTC time-of-day: the instant's UTC calendar date moves by the given months or years, clamping per [LTIM.4.3.2], and the nanoseconds since that date's midnight are kept. A Time stores no zone ([LTIM.1.1.3]), so there is no original offset to preserve. An author who needs the shift on a zone's calendar takes the date in that zone ([LTIM.6.5]), shifts the Date, and reads the instant back from it.

A shift whose result its type cannot represent, a Time outside the range of [LTIM.1.1.5] or a Date outside the range of [LTIM.1.2.2], raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]).

ratified — see also: LERR.1.4.10, LTIM.1.1.3, LTIM.1.1.5, LTIM.1.2.2, LTIM.4.3.2, LTIM.6.5

[LTIM.4.3.4] Operator overload for calendar arithmetic (t + 1mo, t + 1yr) is not admitted. The function form is normative, so the clamp-to-last-day edge case is visible at the call site.


Comparison [LTIM.5]#

[LTIM.5.1] <, <=, >, >=, ==, != are defined for Time, Date, and Duration.

ratified

[LTIM.5.2] Time comparison operates on utc_ns. Two Time values in different timezones compare on their UTC instants; tz_offset_ns is irrelevant to ordering.

ratified

[LTIM.5.3] Date comparison is lexicographic on (year, month, day).

[LTIM.5.4] Duration comparison is integer comparison on the nanosecond count, which is never negative ([LTIM.1.3.1]).

see also: LTIM.1.3.1

[LTIM.5.5] Cross-type comparison is a compile error. Time vs Date, Date vs Duration, etc. produce a type-mismatch diagnostic. Authors convert explicitly: t.date(tz) < d. A Duration beside a bare number is [LUNI.8.3]'s.


ratified — see also: LUNI.8.3

Extraction [LTIM.6]#

[LTIM.6.1] The component slots .hour, .minute, .second, .day_of_week, .day, .month, .year are valid on:

  • The result of t.utc or t.local(tz) for Time values.

  • A Date value directly (only .day, .month, .year, .day_of_week).

A component is a member of its receiver ([LGRA.9.6.2]); one its receiver does not have is DS_VALIDATE_UNKNOWN_MEMBER.

ratified — see also: LGRA.9.6.2

[LTIM.6.2] The compiler must reject a component slot read directly on a Time value that has not been through .utc or .local(tz), with DS_VALIDATE_TIME_NEEDS_TZ_CONTEXT: the component needs a declared timezone context, which those two members supply ([LTIM.6.1]).

ratified — see also: LTIM.6.1

[LTIM.6.3] Component ranges:

Slot

Range

Notes

.hour

0..23

.minute

0..59

.second

0..59

No leap-second representation in v1

.day

1..31

Valid for the given month and year

.month

1..12

ISO / Python convention; not 0..11

.year

full Gregorian year

2024, not '24 or 124

.day_of_week

0..6

0=Monday, 6=Sunday (ISO 8601)

ratified

[LTIM.6.4] The 0=Monday choice for .day_of_week matches ISO 8601. An author carrying a 0=Sunday expectation from C or JavaScript will be off by one day.

[LTIM.6.5] A component of a Time is a function of the instant and a zone. A component read on the result of .utc or .local(tz) ([LTIM.6.1]) is that component of the instant in the zone: UTC for .utc, and for .local(tz) the zone tz names, resolved per [LTIM.10.7]. It is an Int in [LTIM.6.3]'s range. Each component is its own builtin, taking the instant and the zone name — FN_HOUR, FN_MINUTE, FN_SECOND, FN_DAY, FN_MONTH, FN_YEAR and FN_DAY_OF_WEEK in proto/builtin_fn.proto — and the compiler must lower a component read to it.

The zone UTC is offset 0 and consults no fact ([LTIM.10.8]), as .utc itself does not, so a component read in UTC works on an engine that holds no TimeZoneOffset fact. Every other zone is resolved through its facts, with [LTIM.10.5.3]'s failures.

ratified — defined in: proto/builtin_fn.proto#BuiltinFn — see also: LTIM.10.5.3, LTIM.10.7, LTIM.10.8, LTIM.6.1, LTIM.6.3

[LTIM.6.6] A component of a Date is that component of its midnight in UTC. A Date ([LTIM.1.2.1]) is held as the number of days since 1970-01-01 in the proleptic Gregorian calendar, negative before it. The compiler must lower .day, .month, .year and .day_of_week on a Date to the [LTIM.6.5] builtin of the same component, applied to the instant d · 86 400 · 10⁹ nanoseconds and the zone UTC. Every Date has that instant, because its range is the days whose midnight is a Time ([LTIM.1.2.2]), so the read always has an answer. A Date has no .hour, .minute or .second ([LTIM.6.1]).


ratified — see also: LTIM.1.2.1, LTIM.1.2.2, LTIM.6.1, LTIM.6.5

Truncation [LTIM.7]#

[LTIM.7.1] t.floor(d: Duration) → Time, a member of Time ([LGRA.9.6.2]), returns the latest boundary of d at or before t. The boundaries are the multiples of d counted from 1970-01-01T00:00 at t's offset ([LTIM.1.1.1]), so the result's utc_ns is utc_ns - floor_mod(utc_ns + tz_offset_ns, d), and an instant on a boundary floors to itself. The result keeps t's tz_offset_ns.

floor to 0_s has no boundary: it is a ComputationError of kind DIVIDE_BY_ZERO ([LEXP.7.15.1]). A negative d cannot be formed ([LTIM.1.3.1]). A result before the first representable instant is NOT_REPRESENTABLE ([LTIM.1.1.5]).

ratified — see also: LEXP.7.15.1, LGRA.9.6.2, LTIM.1.1.1, LTIM.1.1.5, LTIM.1.3.1

[LTIM.7.2] floor truncates at the offset its receiver carries, so the receiver chooses the boundaries: a .local(tz) receiver truncates at the offset tz gave it when it was resolved ([LTIM.1.1.3]), and a .utc receiver at UTC.

see also: LTIM.1.1.3

[LTIM.7.3] floor consults no timezone, so a DST transition moves no boundary. A Time carries an offset, not a zone ([LTIM.1.1.1]), and floor truncates at that offset ([LTIM.7.1]). For a receiver resolved in a zone that observes DST:

  • Spring-forward. A receiver resolved after the transition carries the new offset, so flooring it to 1_d returns midnight at that offset, an hour before the zone's own midnight on the transition day. America/Los_Angeles, 2026-03-08: 12:00 at −7 h floors to 00:00 at −7 h (07:00Z); the zone's midnight that day is 00:00 at −8 h (08:00Z).

  • Fall-back. The second 1:30 AM carries the standard offset, so flooring it to 1_h returns 1:00 at that offset, the second 1 AM rather than the first. America/Los_Angeles, 2026-11-01: 1:30 at −8 h floors to 1:00 at −8 h (09:00Z).

An author who wants a zone's own boundary floors a value resolved with .local(tz) at an instant on the same side of the transition as that boundary.

see also: LTIM.1.1.1, LTIM.7.1

[LTIM.7.4] floor is not defined on a Date.


Building a temporal value from its fields [LTIM.14]#

DS reads no temporal text: no cast and no member makes a Time, a Date or a Duration from a String ([LCST.4.5.2]). A host or an adapter delivers a temporal value already typed ([LADP.4.2.1], [LTIM.11.2]), and a rule builds one from integer fields with the calendar module ([LIMP.3.3.4]). A Duration is built by unit arithmetic ([LTIM.4.1.1]): h * 1_h + m * 1_min.

see also: LADP.4.2.1, LCST.4.5.2, LIMP.3.3.4, LTIM.11.2, LTIM.4.1.1

[LTIM.14.1] calendar.time and calendar.date. The engine must build each value below from its fields in the proleptic Gregorian calendar ([LTIM.1.2.4]):

Call

Value

calendar.time(year, month, day)

the Time at midnight UTC of that day

calendar.time(year, month, day, hour, minute, second)

the Time at that wall-clock time in UTC

calendar.time(year, month, day, hour, minute, second, nanosecond)

the same instant plus nanosecond nanoseconds

calendar.date(year, month, day)

the Date of that day

Every argument is an Int, and the arities are the three and one above ([LEXP.17.1]). A Time it builds is in UTC: its tz_offset_ns is 0 ([LTIM.1.1.1]), and .local(tz) gives it a zone's offset ([LTIM.3.2.1]).

ratified — see also: LEXP.17.1, LTIM.1.1.1, LTIM.1.2.4, LTIM.3.2.1

[LTIM.14.2] What a call refuses. The engine must raise a ComputationError of kind DOMAIN ([LERR.1.4.10]), and abandon the activation, when a field is outside its range: month outside 1..12, day naming no day of that month in that year, hour outside 0..23, minute or second outside 0..59, or nanosecond outside 0..999 999 999.

A call whose fields are in range and whose value is outside the range of [LTIM.1.1.5] for a Time, or of [LTIM.1.2.2] for a Date, must raise NOT_REPRESENTABLE ([LERR.1.4.10]) and never wrap. The engine must compute the value exactly: where the value is in range, no step of computing it may overflow.

ratified — see also: LERR.1.4.10, LTIM.1.1.5, LTIM.1.2.2

[LTIM.14.3] A call over constants is a constant. A calendar call whose arguments all fold is foldable ([LEXP.8.8]) in every position, and it is the value it names: const LAUNCH = calendar.time(2026, 1, 1) declares a Time constant, and the same call in a where is that constant. It lowers as [RLOW.6.1.8] states. The compiler must refuse such a call whose fold would raise [LTIM.14.2]'s fault, with DS_VALIDATE_CONST_NOT_FOLDABLE, wherever it stands and whether or not the rest of the expression would absorb its result: the call has no value to fold to. The engine evaluates a call with an argument that does not fold when the rule runs, and a call that raises raises there.

ratified — see also: LEXP.8.8, LTIM.14.2, RLOW.6.1.8

Formatting [LTIM.8]#

A temporal value is written as text and never read from it ([LTIM.14]).

see also: LTIM.14

Methods [LTIM.8.1]#

[LTIM.8.1.2] Temporal-to-string, members of Time and Date ([LGRA.9.6.2]) naming a format from [LTIM.8.2]:

t.to_string(format: String) → String
d.to_string(format: String) → String

The ISO-8601 form and the Duration compact form are written by the casts t::String, d::String and dur::String instead ([LCST.4.5.9]).

ratified — see also: LCST.4.5.9, LGRA.9.6.2, LTIM.8.2

[LTIM.8.1.3] The format argument of these members is required. Duration's only text form is the compact form ([LTIM.8.4]), written by the cast dur::String ([LCST.4.5.9]).

see also: LCST.4.5.9, LTIM.8.4

Standard format set [LTIM.8.2]#

[LTIM.8.2.1] The runtime registers exactly the following fixed v1 format identifiers (no rfc3339 / rfc2822 / named or adapter-registered formats):

Identifier

Written as

"iso8601" (the cast form, [LCST.4.5.9])

"2024-01-15T08:00:00-08:00" for Time; "2024-01-15" for Date

"epoch_seconds"

"1705334400" (Time only)

"epoch_millis"

"1705334400000" (Time only)

"epoch_micros"

"1705334400000000" (Time only)

"epoch_nanos"

"1705334400000000000" (Time only); the full Time.utc_ns, exact

The iso8601 text is [LTIM.8.2.3]'s grammar, written as [LTIM.8.2.4] states. The identifiers name output forms only: no format is read ([LTIM.14]).

see also: LCST.4.5.9, LTIM.14, LTIM.8.2.3, LTIM.8.2.4

[LTIM.8.2.1a] The epoch_seconds / epoch_millis / epoch_micros conversions are floor(utc_ns / 10ⁿ) — floor (toward −∞), not truncation-toward-zero. For a negative (pre-epoch) utc_ns the two disagree, and DS is bit-exact, so the rounding direction must not be implementation-defined: utc_ns = -1500 formats as epoch_micros -2, never -1. epoch_nanos is utc_ns itself — no division, exact, and round-trips losslessly.

[LTIM.8.2.2] Format-identifier comparison is case-insensitive: the identifiers of [LTIM.8.2.1] may be written in any case, so "ISO8601" and "iso8601" name the same format.

see also: LTIM.8.2.1

[LTIM.8.2.3] The iso8601 text of a Time is time, and of a Date is date:

time   = date , "T" , hour , ":" , minute , ":" , second ,
         [ "." , digit , { digit } ] , [ zone ] ;
date   = year , "-" , month , "-" , day ;
zone   = "Z" | ( "+" | "-" ) , 2 * digit , [ ":" ] , 2 * digit ;
year   = 4 * digit ;
month  = 2 * digit ;
day    = 2 * digit ;
hour   = 2 * digit ;
minute = 2 * digit ;
second = 2 * digit ;
digit  = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;

ratified

[LTIM.8.2.4] What [LTIM.8.2.3]'s grammar does not carry. ::String of a Time must write the wall-clock time at the value's offset, then the zone: Z for a zero offset, and +hh:mm or -hh:mm otherwise. It writes a fraction only when the value's sub-second part is not zero, as . and nine digits with the trailing zeros removed. ::String of a Date writes date. Every year in the range of [LTIM.1.2.2] has four digits.

ratified — see also: LTIM.1.2.2, LTIM.8.2.3

Format-identifier validation [LTIM.8.3]#

[LTIM.8.3.2] The compiler must validate a format identifier against the fixed v1 set ([LTIM.8.2.1]). An unknown literal identifier is a compile error (DS_VALIDATE_UNKNOWN_TIME_FORMAT); an unknown computed identifier raises a ComputationError of kind NOT_REPRESENTABLE ([LERR.1.4.10]) and abandons the activation. The operation is well typed and there is no answer for a value that names no format.

ratified — see also: LERR.1.4.10, LTIM.8.2.1

Duration form [LTIM.8.4]#

[LTIM.8.4.1] dur::String renders the compact form: adjacent unit-tagged components in descending order of unit size, e.g. "1h30m", "500ms", "2h15s". The units are h, m, s, ms, us and ns, each at most once and in that order. The zero Duration is "0s".

ratified

[LTIM.8.4.2] The compact form omits zero-valued components ("1h" not "1h0m0s"). It carries no sign: dur::String never writes a - ([LTIM.1.3.1]).


see also: LTIM.1.3.1

Timezone resolution [LTIM.10]#

[LTIM.10.1] Timezone resolution is integrator-owned. The runtime must not carry a tzdata bundle; the integrator supplies TimeZoneOffset facts ([LTIM.10.6]).

see also: LTIM.10.6

[LTIM.10.6] The TimeZoneOffset schema. A schema of the built-in module ([LIMP.12.2]), scope logical ambient ([LSCP.2.5]): the integrator asserts its facts, and a rule may match one and must not emit or withdraw one ([LSCP.2.5.1]). Each fact is one zone's offset over one period. Its identity is (zone, valid_from) ([LFAC.1.7]).

Slot

Type

Marker

Meaning

zone

String

key

the designation the fact resolves, compared byte for byte: no normalisation, and case is significant

valid_from

Time

key

the first instant of the period, inclusive

valid_until

Time

mutable

the end of the period, exclusive

offset_s

Int

mutable

the offset in force over the period, in seconds east of UTC

ratified — see also: LFAC.1.7, LIMP.12.2, LSCP.2.5, LSCP.2.5.1

[LTIM.10.7] Resolving a zone. To resolve a designation Z other than "UTC" ([LTIM.10.8]) at an instant t, in nanoseconds since the Unix epoch, the engine must take, among the live TimeZoneOffset facts ([LTIM.10.6]) whose zone equals Z byte for byte, the one with the greatest valid_from not after t. If that fact's valid_until is after t, its offset_s is the answer. Otherwise, and when no such fact exists, Z has no answer at t ([LTIM.10.5.3]). The facts of one zone may overlap: this rule decides which one answers, whatever order they arrived in.

A period is half-open, so no valid_until is after the last instant of the Time range ([LTIM.1.1.5]), and no zone but "UTC" has an answer there: a read in Z at that instant is [LTIM.10.5.3]'s failure, however the facts are written. The longest period a fact can state ends one nanosecond before it.

A resolution must cost O(log r), where r is the number of live TimeZoneOffset facts whose zone is Z, and must not depend on any other fact ([LCNT.5.2]).

A resolution sees every TimeZoneOffset fact the host has asserted, replaced or retracted before it. No host assert or retract runs during a pump ([NLFC.3.3], [RARC.13.16]), so every resolution of one zone at one instant within a pump answers alike. A replay delivers those facts where the trace records them ([LFST.6.1.1]), so it resolves as the recorded run did.

A change to a zone's facts re-evaluates a where that resolves the zone, as any time-dependent condition is re-evaluated ([LTIM.2.4.1], [LTIM.2.5.1]). It does not re-run an action that has already fired: a value an action computed from an earlier fact stands.

ratified — see also: LCNT.5.2, LFST.6.1.1, LTIM.1.1.5, LTIM.10.5.3, LTIM.10.6, LTIM.10.8, LTIM.2.4.1, LTIM.2.5.1, NLFC.3.3, RARC.13.16

[LTIM.10.8] Only UTC needs no row. The designation that is exactly the string "UTC" is offset 0 at every instant, and the engine must resolve it without consulting any TimeZoneOffset fact. Every other designation, "UTC+8", "utc" and "PST" included, is a zone name like any other: it resolves only through facts the host supplied under that exact string ([LTIM.10.7]). The engine reads no offset out of a designation.

ratified — see also: LTIM.10.7

[LTIM.10.9] The engine refuses a malformed TimeZoneOffset fact. The engine must refuse a host assert of a TimeZoneOffset fact with DS_ERR_INVAL, and assert nothing, when:

  • its valid_from is not before its valid_until;

  • its offset_s is below -64800 or above 64800, eighteen hours either way;

  • its zone is "UTC", which no fact resolves ([LTIM.10.8]).

A fact whose period overlaps another fact of its zone is admitted, and [LTIM.10.7] decides which answers. No rule asserts a TimeZoneOffset fact ([LSCP.2.5.1]), and no initial block holds one ([LGRA.24.2]).

ratified — see also: LGRA.24.2, LSCP.2.5.1, LTIM.10.7, LTIM.10.8

[LTIM.10.10] Coverage is the integrator's. For each zone a program resolves, the integrator should supply TimeZoneOffset facts covering every instant the program resolves it at: in practice from the oldest timestamp its data carries to a horizon past the present, extended before the last fact's valid_until arrives. An instant no fact covers has no answer ([LTIM.10.5.3]), and the engine supplies none in its place ([LTIM.10.5.4]).

see also: LTIM.10.5.3, LTIM.10.5.4

[LTIM.10.3] A zone is resolved ([LTIM.10.7]) at two sites, and no others:

  • t.local(tz) evaluation per [LTIM.3.2.1].

  • t.date(tz) evaluation per [LTIM.3.3.1].

Writing a temporal value as text resolves no zone. The ::String cast ([LCST.4.5.9]) and the to_string member ([LTIM.8.1.2]) write the value's own offset ([LTIM.8.2.4]), and the epoch_* forms ([LTIM.8.2.1]) are UTC integers. calendar.time resolves none either: it builds a UTC instant ([LTIM.14.1]).

see also: LCST.4.5.9, LTIM.10.7, LTIM.14.1, LTIM.3.2.1, LTIM.3.3.1, LTIM.8.1.2, LTIM.8.2.1, LTIM.8.2.4

Failure policy [LTIM.10.5]#

[LTIM.10.5.1] Timezone resolution failure is a hard error: the runtime must never answer it with a silent fallback to UTC ([LTIM.10.5.4]). It surfaces as [LTIM.10.5.3] states.

see also: LTIM.10.5.3, LTIM.10.5.4

[LTIM.10.5.3] Failure at rule evaluation (.local(tz), .date(tz)): runtime error. The rule must not fire. An unresolvable zone string in rule source is a visible failure, not a silent rejection.

When no TimeZoneOffset fact answers for the zone at the instant ([LTIM.10.7]), such an evaluation is a ComputationError of kind DOMAIN ([LERR.1.4.10]), as a now() read is while the wall clock has no value: the activation is abandoned, the fault is a stream event ([NCBK.2.8]), and the engine continues. It is not an EngineError, and the tier does not halt. This holds whatever supplied the zone, a literal in rule source or a value read from data: a zone with no fact in force is a read with no answer, not a sign that the artefact or the data is unsound. A zone operand that is not a String, or is null, is not a zone to resolve, and stays a type mismatch.

ratified — see also: LERR.1.4.10, LTIM.10.7, NCBK.2.8

[LTIM.10.5.4] The runtime must not silently fall back to UTC. A misspelled zone string produces a noisy error, not mysteriously non-firing rules.


Wire format [LTIM.11]#

[LTIM.11.2] A temporal value crosses the boundary typed. A host or an adapter must deliver a Time, a Date or a Duration into a slot of that type ([NFCT.2.3], [LADP.4.2.1]), converting its source's form itself. The engine reads no temporal text, and a Json slot carries no temporal value: text inside a Json document is a String to a rule, whatever it spells ([LTIM.14]).


see also: LADP.4.2.1, LTIM.14, NFCT.2.3

Daylight saving time [LTIM.12]#

[LTIM.12.11] DST: no wall-clock time is resolved to an instant, so no gap or overlap arises. Every resolution goes from an instant to an offset: a zone is resolved at an instant ([LTIM.10.7]), and calendar.time builds a UTC instant ([LTIM.14.1]). A local time skipped at spring-forward, or repeated at fall-back, is never read. What a value that carries an offset does across a transition is [LTIM.7.3]'s.

ratified — see also: LTIM.10.7, LTIM.14.1, LTIM.7.3