std:datetime/Time
std:datetime/Time
Section titled “std:datetime/Time”Canonical occurrence:
protos/lib/datetime/Time.protos· Protos revision:e99b712ecf658a527b1fe82c8beba2c1286d8dc9.
Local civil times of day with nanosecond precision. A time is a frozen
ordinary object with Integer hour (0 through 23), minute (0
through 59), second (0 through 59), and nanosecond (0 through
999999999) slots; it carries no date, offset, zone, or clock state.
Leap-second labels (second == 60) are not supported.
Every time’s immediate delegation parent is this module, the canonical
time factory and prototype. recognizes accepts exactly the times of this
family: objects whose immediate parent is this module and whose local slots
are exactly the time state and behavior slots with a valid state. Matching
slots under another parent are not a time.
Times answer semantic equality through ==: two times are equal when both
are times and their hour, minute, second, and nanosecond are equal. hash is coherent with that
equality, so independently constructed equal times work as the same Map
key. === remains ordinary object identity. compare is the natural
time-of-day order and answers 0 exactly for equal times.
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 time for hour, minute, second, and
nanosecond. Every argument must be an Integer within its field range;
otherwise an Error is signalled. No field is clamped, wrapped, or
normalized, and second == 60 is rejected.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
hour,minute,second,nanosecond -
Rest parameter: none
-
Source occurrence:
protos/lib/datetime/Time.protos:38 -
Exact source page: open in the source browser
compare
Section titled “compare”Answers -1, 0, or 1 as time left is earlier than, equal to, or later
than time right within a day, ordering by hour, minute, second, then
nanosecond. The result is 0 exactly when left == right. Arguments must
be times 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/Time.protos:115 -
Exact source page: open in the source browser
recognizes
Section titled “recognizes”Answers true exactly when value is a time of this family: its immediate
delegation parent is this module, its local slots are exactly hour,
minute, second, nanosecond, equals, ==, and hash, and every
field is an Integer within its range. Answers false for any other value.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
value -
Rest parameter: none
-
Source occurrence:
protos/lib/datetime/Time.protos:84 -
Exact source page: open in the source browser
Exact module source · Standard-library API · Standard library overview