Skip to main content

Module time

Module time 

Source
Expand description

Wall-clock conversion, parsing, and duration-formatting utilities.

The helpers convert between SystemTime and the Unix epoch, parse human-readable durations, and choose display units. These clocks are not monotonic and can be affected by system-time changes.

Modules§

exponential_backoff
Retry-backoff calculations.

Enums§

Unit
Represents an integral duration in one selected unit.

Functions§

duration_since_epoch
Converts a system time into a nonnegative duration since the Unix epoch.
format
Formats a system time in UTC with a Chrono format string.
now
Returns the current wall-clock duration since the Unix epoch.
now_millis
Returns the current wall-clock time as whole milliseconds since the Unix epoch.
now_secs
Returns the current wall-clock time as whole seconds since the Unix epoch.
parse_duration
Parses a human-readable duration with the cyborgtime parser.
parse_timepoint_ago
Parses a duration and returns the wall-clock time that far in the past.
pretty
Formats a duration with one plural human-readable unit.
rfc2822_from_seconds
Formats a signed Unix timestamp as RFC 2822 text in UTC.
timepoint_ago
Subtracts a duration from the current wall-clock time using checked arithmetic.
timepoint_from_epoch
Adds a duration to the Unix epoch using checked arithmetic.
timepoint_from_now
Adds a duration to the current wall-clock time using checked arithmetic.
timepoint_has_passed
Checks whether a system time is at or before the current wall-clock time.
whole_and_frac
Pairs a duration’s selected whole unit with a floating-point scale component.
whole_unit
Selects the largest integral unit represented by a duration.