Skip to main content

Module time

Module time 

Source
Expand description

Today’s date and the time of day, in the user’s time zone.

The Host reads them itself, so nothing about them crosses the boundary. On desktop, iOS and Android the C library converts an instant with the time zone the operating system is set to; a TZ in the environment wins, as it does for every program on those systems. In a browser the page’s Date answers, which is the browser’s time zone.

subscribe_date_change wakes a reader once when the date changes: at local midnight, or when the user moves to a time zone where it is already another day.

Structs§

DateChangeSubscription
A registration for date changes. Dropping it ends the registration.
LocalDate
A date on the calendar of the user’s time zone.
LocalDateTime
A moment as the clock on the user’s wall shows it.

Enums§

Weekday
A day of the week.

Functions§

local_at
What the wall clock in the user’s time zone showed, or will show, at instant.
now_local
The current date and time of day in the user’s time zone.
subscribe_date_change
Registers notify to be called once each time the date in the user’s time zone changes: when local midnight passes, or when the user moves to a time zone where it is another day. Called on a Host worker thread, or in a browser at the start of a frame, so it does what any worker does with a change: update a signal, which asks for a frame.
today
Today’s date in the user’s time zone.