std:datetime/Offset
std:datetime/Offset
Section titled “std:datetime/Offset”Canonical occurrence:
protos/lib/datetime/Offset.protos· Protos revision:e99b712ecf658a527b1fe82c8beba2c1286d8dc9.
Fixed offsets from the reference timeline, in whole seconds. An offset is
a frozen ordinary object with one Integer seconds slot holding the exact
signed displacement, from -64800 (-18:00:00) through 64800
(+18:00:00) inclusive, with one-second resolution. Local civil time is
the reference timeline plus the offset.
An offset is a fixed displacement, not a time-zone identity: it carries no
zone name, no historical or future rules, no daylight-saving information,
and no time-zone database authority. Offset(0) is an ordinary known zero
offset.
Every offset’s immediate delegation parent is this module, the canonical
offset factory and prototype. recognizes accepts exactly the offsets of
this family: objects whose immediate parent is this module and whose local
slots are exactly the offset state and behavior slots with a valid state.
Offsets answer semantic equality through ==: two offsets are equal when
both are offsets and their displacements are equal. hash is coherent with
that equality, so independently constructed equal offsets work as the same
Map key. === remains ordinary object identity. compare is the natural
numeric order of the displacements and answers 0 exactly for equal
offsets.
Observable top-level slots
Section titled “Observable top-level slots”This page lists the complete mechanically observable top-level slot inventory required by D067. Authored documentation, when present, is canonical D062 prose; mechanical presence alone does not create a stability or compatibility promise.
Answers a fresh frozen offset of exactly seconds seconds. seconds must
be an Integer from -64800 through 64800; any other argument signals an
Error. The value is never clamped or wrapped.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
seconds -
Rest parameter: none
-
Source occurrence:
protos/lib/datetime/Offset.protos:42 -
Exact source page: open in the source browser
compare
Section titled “compare”Answers -1, 0, or 1 as offset left is numerically less than, equal
to, or greater than offset right, comparing total seconds. The result is
0 exactly when left == right. Arguments must be offsets recognized by
this module; otherwise an Error is signalled.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
left,right -
Rest parameter: none
-
Source occurrence:
protos/lib/datetime/Offset.protos:99 -
Exact source page: open in the source browser
recognizes
Section titled “recognizes”Answers true exactly when value is an offset of this family: its
immediate delegation parent is this module, its local slots are exactly
seconds, equals, ==, and hash, and seconds is an Integer from
-64800 through 64800. Answers false for any other value.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
value -
Rest parameter: none
-
Source occurrence:
protos/lib/datetime/Offset.protos:80 -
Exact source page: open in the source browser
Exact module source · Standard-library API · Standard library overview