Module cloudi_timestamp

Timestamp operations

.

Copyright © 2015-2020 Michael Truog

Version: 2.0.1 Nov 26 2020 15:50:58 ------------------------------------------------------------------------

Authors: Michael Truog (mjtruog at protonmail dot com).

Description

Timestamp operations

Data Types

iso8601()

iso8601() = [48..57 | 84 | 45 | 58 | 46 | 90, ...]

timestamps as 1970-01-01T00:00:00Z

iso8601_seconds()

iso8601_seconds() = [48..57 | 84 | 45 | 58 | 90, ...]

microseconds_epoch()

microseconds_epoch() = non_neg_integer()

microseconds_monotonic()

microseconds_monotonic() = integer()

milliseconds_epoch()

milliseconds_epoch() = non_neg_integer()

milliseconds_monotonic()

milliseconds_monotonic() = integer()

nanoseconds_epoch()

nanoseconds_epoch() = non_neg_integer()

monotonic time values may be negative

nanoseconds_monotonic()

nanoseconds_monotonic() = integer()

native_monotonic()

native_monotonic() = integer()

timestamps as 1970-01-01T00:00:00.000000Z or 1970-01-01T00:00:00.000Z

seconds_epoch()

seconds_epoch() = non_neg_integer()

seconds_monotonic()

seconds_monotonic() = integer()

time_unit()

time_unit() = second | millisecond | microsecond | nanosecond | native | perf_counter | pos_integer()

UNIX epoch (1970-01-01T00:00:00Z) offsets (POSIX time)

Function Index

convert/3

Convert between time units.

.
datetime_utc_to_string/1

Create an ISO8601 timestamp from a datetime in UTC.

.
microseconds/0

Microseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z).
microseconds_epoch_to_string/1

Create an ISO8601 timestamp from microseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00.000000Z).
microseconds_monotonic/0

Microseconds since an undefined point in time, from the Erlang VM.

.
microseconds_os/0

Microseconds since the UNIX epoch, from the hardware.

Always prefer the microseconds function instead of this function.
milliseconds/0

Milliseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z).
milliseconds_epoch_to_string/1

Create an ISO8601 timestamp from milliseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00.000Z).
milliseconds_monotonic/0

Milliseconds since an undefined point in time, from the Erlang VM.

.
milliseconds_os/0

Milliseconds since the UNIX epoch, from the hardware.

Always prefer the milliseconds function instead of this function.
nanoseconds/0

Nanoseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z).
nanoseconds_monotonic/0

Nanoseconds since an undefined point in time, from the Erlang VM.

.
nanoseconds_os/0

Nanoseconds since the UNIX epoch, from the hardware.

Always prefer the nanoseconds function instead of this function.
nanoseconds_to_string/1

Format a nanoseconds duration as a minimal string with lower-precision integers.

.
nanoseconds_to_string/2

Format a nanoseconds duration with options as a minimal string with lower-precision integers.

.
native/0

Native time units since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z).
native_monotonic/0

Native time units since an undefined point in time, from the Erlang VM.

.
native_os/0

Native time units since the UNIX epoch, from the hardware.

Always prefer the mative function instead of this function.
seconds/0

Seconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z).
seconds_epoch_to_string/1

Create an ISO8601 timestamp from seconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z).
seconds_filter/3

Filter a list of seconds since the UNIX epoch.

The list is not ordered.
seconds_filter_monotonic/3

Filter a list of seconds since an undefined point in time, from the Erlang VM.

The list is not ordered.
seconds_monotonic/0

Seconds since an undefined point in time, from the Erlang VM.

.
seconds_os/0

Seconds since the UNIX epoch, from the hardware.

Always prefer the seconds function instead of this function.
seconds_to_string/1

Format a seconds duration as a minimal string with lower-precision integers.

.
seconds_to_string/2

Format a seconds duration with options as a minimal string with lower-precision integers.

.
timestamp/0

Return an Erlang VM timestamp.

Not guaranteed to be strictly monotonically increasing (on Erlang >= 18.0).
uptime/0

The uptime of the Erlang node in seconds.

.
uptime/1

The uptime of the Erlang node.

.
uptime_days/0

The uptime of the Erlang node in days.

.
uptime_months/0

The uptime of the Erlang node in months.

.
uptime_years/0

The uptime of the Erlang node in years.

.

Function Details

convert/3

convert(Time::integer(), FromUnit::time_unit(), ToUnit::time_unit()) -> integer()

Convert between time units.

datetime_utc_to_string/1

datetime_utc_to_string(DateTimeUTC::calendar:datetime()) -> iso8601_seconds()

Create an ISO8601 timestamp from a datetime in UTC.

microseconds/0

microseconds() -> microseconds_epoch()

Microseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

microseconds_epoch_to_string/1

microseconds_epoch_to_string(MicroSeconds::microseconds_epoch()) -> iso8601()

Create an ISO8601 timestamp from microseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00.000000Z)

microseconds_monotonic/0

microseconds_monotonic() -> microseconds_monotonic()

Microseconds since an undefined point in time, from the Erlang VM.

microseconds_os/0

microseconds_os() -> microseconds_epoch()

Microseconds since the UNIX epoch, from the hardware.

Always prefer the microseconds function instead of this function. (The UNIX epoch is 1970-01-01T00:00:00Z)

milliseconds/0

milliseconds() -> milliseconds_epoch()

Milliseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

milliseconds_epoch_to_string/1

milliseconds_epoch_to_string(MilliSeconds::milliseconds_epoch()) -> iso8601()

Create an ISO8601 timestamp from milliseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00.000Z)

milliseconds_monotonic/0

milliseconds_monotonic() -> milliseconds_monotonic()

Milliseconds since an undefined point in time, from the Erlang VM.

milliseconds_os/0

milliseconds_os() -> milliseconds_epoch()

Milliseconds since the UNIX epoch, from the hardware.

Always prefer the milliseconds function instead of this function. (The UNIX epoch is 1970-01-01T00:00:00Z)

nanoseconds/0

nanoseconds() -> nanoseconds_epoch()

Nanoseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

nanoseconds_monotonic/0

nanoseconds_monotonic() -> nanoseconds_monotonic()

Nanoseconds since an undefined point in time, from the Erlang VM.

nanoseconds_os/0

nanoseconds_os() -> nanoseconds_epoch()

Nanoseconds since the UNIX epoch, from the hardware.

Always prefer the nanoseconds function instead of this function. (The UNIX epoch is 1970-01-01T00:00:00Z)

nanoseconds_to_string/1

nanoseconds_to_string(TotalNanoSeconds::non_neg_integer()) -> cloudi_service_api:nanoseconds_string()

Format a nanoseconds duration as a minimal string with lower-precision integers.

nanoseconds_to_string/2

nanoseconds_to_string(TotalNanoSeconds::integer(), Options::signed) -> cloudi_service_api:nanoseconds_string_signed()

Format a nanoseconds duration with options as a minimal string with lower-precision integers.

native/0

native() -> integer()

Native time units since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

native_monotonic/0

native_monotonic() -> native_monotonic()

Native time units since an undefined point in time, from the Erlang VM.

native_os/0

native_os() -> integer()

Native time units since the UNIX epoch, from the hardware.

Always prefer the mative function instead of this function. (The UNIX epoch is 1970-01-01T00:00:00Z)

seconds/0

seconds() -> seconds_epoch()

Seconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

seconds_epoch_to_string/1

seconds_epoch_to_string(Seconds::seconds_epoch()) -> iso8601_seconds()

Create an ISO8601 timestamp from seconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

seconds_filter/3

seconds_filter(L::[seconds_epoch()], SecondsNow::seconds_epoch(), MaxPeriod::pos_integer()) -> {Count::non_neg_integer(), NewL::[seconds_epoch()]}

Filter a list of seconds since the UNIX epoch.

The list is not ordered.

seconds_filter_monotonic/3

seconds_filter_monotonic(L::[seconds_monotonic()], SecondsNow::seconds_monotonic(), MaxPeriod::pos_integer()) -> {Count::non_neg_integer(), NewL::[seconds_monotonic()]}

Filter a list of seconds since an undefined point in time, from the Erlang VM.

The list is not ordered.

seconds_monotonic/0

seconds_monotonic() -> seconds_monotonic()

Seconds since an undefined point in time, from the Erlang VM.

seconds_os/0

seconds_os() -> seconds_epoch()

Seconds since the UNIX epoch, from the hardware.

Always prefer the seconds function instead of this function. (The UNIX epoch is 1970-01-01T00:00:00Z)

seconds_to_string/1

seconds_to_string(TotalSeconds::non_neg_integer()) -> cloudi_service_api:seconds_string()

Format a seconds duration as a minimal string with lower-precision integers.

seconds_to_string/2

seconds_to_string(TotalSeconds::integer(), Options::signed) -> cloudi_service_api:seconds_string_signed()

Format a seconds duration with options as a minimal string with lower-precision integers.

timestamp/0

timestamp() -> erlang:timestamp()

Return an Erlang VM timestamp.

Not guaranteed to be strictly monotonically increasing (on Erlang >= 18.0).

uptime/0

uptime() -> non_neg_integer()

The uptime of the Erlang node in seconds.

uptime/1

uptime(TimeUnit::second | millisecond | microsecond | nanosecond) -> non_neg_integer()

The uptime of the Erlang node.

uptime_days/0

uptime_days() -> float()

The uptime of the Erlang node in days.

uptime_months/0

uptime_months() -> float()

The uptime of the Erlang node in months.

uptime_years/0

uptime_years() -> float()

The uptime of the Erlang node in years.


Generated by EDoc