View Source Nebulex.Time (Nebulex v2.6.4)

Time utilities.

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.

Functions

Link to this function

now(unit \\ :millisecond)

View Source
@spec now(System.time_unit()) :: integer()

Returns the current system time in the given time unit.

The unit is set to :millisecond by default.

Examples

iex> now = Nebulex.Time.now()
iex> is_integer(now) and now > 0
true
@spec 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

iex> Nebulex.Time.timeout?(1.1)
false