macula_time (macula v0.20.5)
View SourceTime utilities for Macula. Provides functions for timestamps, durations, and timeouts.
Summary
Functions
Calculate duration in milliseconds between two timestamps.
Format duration in milliseconds to human-readable string.
Format timestamp to ISO 8601 string.
Check if timeout has expired.
Convert minutes to milliseconds.
Convert milliseconds to seconds (truncates).
Convert seconds to milliseconds.
Calculate remaining time before timeout (in milliseconds). Returns 0 if already expired.
Get current timestamp in milliseconds since epoch.
Get current timestamp in microseconds since epoch.
Functions
-spec duration_ms(integer(), integer()) -> non_neg_integer().
Calculate duration in milliseconds between two timestamps.
-spec format_duration_ms(non_neg_integer()) -> binary().
Format duration in milliseconds to human-readable string.
Format timestamp to ISO 8601 string.
-spec is_expired(integer(), pos_integer()) -> boolean().
Check if timeout has expired.
-spec minutes_to_ms(non_neg_integer()) -> non_neg_integer().
Convert minutes to milliseconds.
-spec ms_to_seconds(non_neg_integer()) -> non_neg_integer().
Convert milliseconds to seconds (truncates).
-spec seconds_to_ms(non_neg_integer()) -> non_neg_integer().
Convert seconds to milliseconds.
-spec time_remaining(integer(), pos_integer()) -> non_neg_integer().
Calculate remaining time before timeout (in milliseconds). Returns 0 if already expired.
-spec timestamp() -> integer().
Get current timestamp in milliseconds since epoch.
-spec timestamp_microseconds() -> integer().
Get current timestamp in microseconds since epoch.