Nebulex.Time (Nebulex v2.0.0) View Source

Time utilities.

Link to this section Summary

Functions

Returns the current system time in the given time unit.

Returns true if the given timeout is a valid timeout; otherwise, false is returned.

Link to this section Functions

Link to this function

now(unit \\ :millisecond)

View Source

Specs

Returns the current system time in the given time unit.

The unit is set to :millisecond by default.

Examples

iex> Nebulex.Time.now()
_milliseconds

Specs

timeout?(term()) :: boolean()

Returns true if the given timeout is a valid timeout; otherwise, false is returned.

Valid timeout: :infinity | non_neg_integer().

Examples

iex> Nebulex.Time.timeout?(1)
true

iex> Nebulex.Time.timeout?(:infinity)
true

iex> Nebulex.Time.timeout?(-1)
false