Ascii.Kit.Clock (Ascii v0.3.0)

Copy Markdown View Source

The wall clock for clock: true pieces, from env.now.

Upstream reads Date.now() and the local time from Date. Here env.now is a DateTime, whose own offset says what local time it is, or nil for the system clock in the system's time zone.

Summary

Functions

The local wall time at ms milliseconds since the epoch, as new Date(ms) reads it: in env.now's offset, or the system's time zone.

Milliseconds since the epoch: Date.now().

getDay(): 0 for Sunday to 6 for Saturday.

Functions

local(env, ms)

@spec local(env :: Ascii.Env.t(), ms :: number()) :: NaiveDateTime.t()

The local wall time at ms milliseconds since the epoch, as new Date(ms) reads it: in env.now's offset, or the system's time zone.

now_ms(env)

@spec now_ms(env :: Ascii.Env.t()) :: integer()

Milliseconds since the epoch: Date.now().

weekday(date)

@spec weekday(date :: Date.t() | NaiveDateTime.t()) :: 0..6

getDay(): 0 for Sunday to 6 for Saturday.