std/time
Time: points in time (Instant), the spans between them (Duration), points on the wall clock (Timestamp), and
Clock, which reads both clocks of the machine. The calendar is Date, a day of the proleptic Gregorian years 0000
to 9999, and Weekday; Timestamp.parse and Date.parse read RFC 3339 text and fail with a TimeParseError. The
wall clock without a zone database is TimeOfDay, DateTime (a date and a time, no offset), UtcOffset (a fixed
offset in whole seconds) and OffsetDateTime (a DateTime with its offset, so an instant that remembers how it was
written); named zones and daylight saving are not here.
The three values are a count of nanoseconds in an Int64 and nothing else, so they cost what the number costs:
comparing and subtracting them is integer arithmetic, and only reading a clock goes to the operating system. They are
in the prelude and reach nothing; Clock and sleep are the capability, and an import of them is what says a file
reads the time. Date, Weekday and TimeParseError read nothing either, and are an import because a name like
Date in every file would clash with the types of the program.
Modules
std/time/libTime: points in time (Instant), the spans between them (Duration), points on the wall clock (Timestamp), andClock, which reads both clocks of the machine.
Everything
- type
ClockThe two clocks of the machine: the monotonic one [Clock.now] measures with, and the wall clock [Clock.timestamp] tells the date by. - type
DateA day in the proleptic Gregorian calendar, from 0000-01-01 to 9999-12-31: no time of day, no offset and no zone, so it is the day a calendar shows and not a point in time. - type
DateTimeA date and a time on the wall clock with no offset and no zone: the "local" date and time a calendar and a clock show together,2026-09-27T08:15:00. - type
DurationThe span between twoInstants, or a length of time asked for on its own (2.seconds()). - type
InstantA point in time. - extend
Int64The short way to write a [Duration]:2.seconds()instead of a constructor. - type
OffsetDateTimeA [DateTime] with the [UtcOffset] it was written in:2026-09-27T10:15:00+02:00, the RFC 3339date-timeof most protocols and databases. - fn
sleepSuspends the running task for this many seconds. - type
TimeOfDayA time on the wall clock, from 00:00:00 to 23:59:59.999999999: no date, no offset and no zone, so it is what a clock face shows and not a point in time. - type
TimeParseErrorWhat reading a [Date] or a [Timestamp] from text fails with, and building a [Date] from numbers that are no day: a sentence that says what is wrong and, where it reads text, quotes it. - type
TimestampA point on the wall clock: nanoseconds since 1970-01-01 00:00:00 UTC. - type
UtcOffsetA fixed offset from UTC in whole seconds, from -23:59:59 to +23:59:59: the+02:00at the end of an RFC 3339 text. - type
WeekdayA day of the week.