Skip to main content

Module time

Module time 

Source
Expand description

time module provides re-export of WASM32-compatible Instant and provides platform neutral implementations for unixtime_as_millis_u128() and unixtime_as_millis_f64().

Structs§

Duration
re-export of [instant] crate supporting native and WASM implementations A Duration type to represent a span of time, typically used for system timeouts.
Instant
re-export of [instant] crate supporting native and WASM implementations A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
SystemTime
re-export of [instant] crate supporting native and WASM implementations A measurement of the system clock, useful for talking to external entities like the file system or other processes.
SystemTimeError
re-export of [instant] crate supporting native and WASM implementations An error returned from the duration_since and elapsed methods on SystemTime, used to learn how far in the opposite direction a system time lies.
TryFromFloatSecsError
re-export of [instant] crate supporting native and WASM implementations An error which can be returned when converting a floating-point value of seconds into a Duration.

Enums§

TimeFormat
Selects how unix timestamps are rendered to locale strings.

Constants§

DAYS
Number of milliseconds in one day.
HOURS
Number of milliseconds in one hour.
MINUTES
Number of milliseconds in one minute.
SECONDS
Number of milliseconds in one second.
UNIX_EPOCH
re-export of [instant] crate supporting native and WASM implementations An anchor in time which can be used to create new SystemTime instances or learn about where in time a SystemTime lies.

Functions§

init_desired_time_format
Sets the TimeFormat used by unixtime_to_locale_string for subsequent native timestamp formatting.
unixtime_as_millis_f64
Returns the current unix time in milliseconds as an f64.
unixtime_as_millis_u64
Returns the current unix time in milliseconds as a u64.
unixtime_as_millis_u128
Returns the current unix time in milliseconds as a u128.
unixtime_to_locale_string
Formats a unix time in milliseconds as a local-time string using the format configured via init_desired_time_format.