Search documentation of macula

# macula_time (macula v4.4.1)

View Source

Time utilities for Macula. Provides functions for timestamps, durations, and timeouts.

# Summary

## Functions

duration_ms(StartTimestamp, EndTimestamp)

Calculate duration in milliseconds between two timestamps.

format_duration_ms(Ms)

Format duration in milliseconds to human-readable string.

format_timestamp(TimestampMs)

Format timestamp to ISO 8601 string.

is_expired(StartTimestamp, TimeoutMs)

Check if timeout has expired.

minutes_to_ms(Minutes)

Convert minutes to milliseconds.

ms_to_seconds(Ms)

Convert milliseconds to seconds (truncates).

seconds_to_ms(Seconds)

Convert seconds to milliseconds.

time_remaining(StartTimestamp, TimeoutMs)

Calculate remaining time before timeout (in milliseconds). Returns 0 if already expired.

timestamp()

Get current timestamp in milliseconds since epoch.

timestamp_microseconds()

Get current timestamp in microseconds since epoch.

# Functions

# duration_ms(StartTimestamp, EndTimestamp)

    -spec duration_ms(integer(), integer()) -> non_neg_integer().

Calculate duration in milliseconds between two timestamps.

# format_duration_ms(Ms)

    -spec format_duration_ms(non_neg_integer()) -> binary().

Format duration in milliseconds to human-readable string.

# format_timestamp(TimestampMs)

    -spec format_timestamp(integer()) -> binary().

Format timestamp to ISO 8601 string.

# is_expired(StartTimestamp, TimeoutMs)

    -spec is_expired(integer(), pos_integer()) -> boolean().

Check if timeout has expired.

# minutes_to_ms(Minutes)

    -spec minutes_to_ms(non_neg_integer()) -> non_neg_integer().

Convert minutes to milliseconds.

# ms_to_seconds(Ms)

    -spec ms_to_seconds(non_neg_integer()) -> non_neg_integer().

Convert milliseconds to seconds (truncates).

# seconds_to_ms(Seconds)

    -spec seconds_to_ms(non_neg_integer()) -> non_neg_integer().

Convert seconds to milliseconds.

# time_remaining(StartTimestamp, TimeoutMs)

    -spec time_remaining(integer(), pos_integer()) -> non_neg_integer().

Calculate remaining time before timeout (in milliseconds). Returns 0 if already expired.

# timestamp()

    -spec timestamp() -> integer().

Get current timestamp in milliseconds since epoch.

# timestamp_microseconds()

    -spec timestamp_microseconds() -> integer().

Get current timestamp in microseconds since epoch.