time: wall-clock DateTime, TimeOfDay and fixed UTC offsets #387
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Slice 2 of FIRST-PARTY.md gap 11 ("a wall-clock date and time, zones"): the wall-clock types and fixed UTC offsets, without a time zone database. Needed by every database driver's
timestamp/timestamptz, S3 and HTTP. Depends on theDate/TimeParseError/Timestamp.parseslice (#111).Design (decided by the loop)
In
std/time, none in the prelude, none reaching a capability (add tocapabilityOfImportincompiler/src/package/archive.trbandcompiler/tests/capability.test.trb):TimeOfDay: hour 0-23, minute, second 0-59, nanosecond; private nanoseconds-of-day field;of(hour, minute, second, nanosecond = 0), accessors,Compare, Equals, Hash, Show(08:15:00.25),parse.UtcOffset: whole seconds from UTC, range -23:59:59..+23:59:59 (RFC 3339 writes minutes only, but databases send seconds);utc,ofMinutes,ofSeconds,show(Z-less:+02:00,+00:00),parse(+hh:mm,Z).DateTime: aDateand aTimeOfDaywith no offset or zone (a "local" date and time);Compare, Equals, Hash, Show(2026-09-27T08:15:00),parse,plus(Duration),Date/TimeOfDayaccessors.OffsetDateTime:DateTimeplusUtcOffset;parseof RFC 3339 keeping the written offset;instant(): Result<Timestamp, TimeParseError>;Timestamp.at(offset: UtcOffset): OffsetDateTime;showwrites RFC 3339 with the offset (2026-09-27T10:15:00+02:00) soparse(show(x)) == x.Equalscompares the fields (same instant, different offset is not equal);Compareby instant.Acceptance criteria
std/timestd/time/tests/: midnight and 23:59:59.999999999, invalid fields refused, offsets+14:00,-12:00,+05:45,Z, conversionOffsetDateTime<->Timestampacross the epoch and a leap day,DateTime.plusover month/year borders, show/parse round tripsdocs/standard-library/time.mdupdated,skills/regenerated, FIRST-PARTY.md gap 11 progress notedDependencies
#111 (Date, TimeParseError, Timestamp.parse).
[loop:torbscript] intake: in scope, no duplicate, dependencies closed (#61 / #111), definition of ready met (goal, acceptance criteria, design, no seed impact). Set
ready. next: implement[loop:torbscript] claim implement by session:loop-torbscript-20261021 until 2026-10-21T04:00:43Z
[loop:torbscript] implement: PR #395 opened (one commit,
feat(time)), forge CI green (tier A, gates, bootstrap, pdisc; tier B skipped by the change filter). TimeOfDay, UtcOffset, DateTime, OffsetDateTime and Timestamp.at in std/time, 36 new tests, capability listing and test, time.md, regenerated skills/, FIRST-PARTY gap 11. No seed impact. Worker token usage: not measurable from inside the worker session. next: review