Nebulex v2.0.0-rc.0 Nebulex.Time View Source
Time utilities.
Link to this section Summary
Functions
Returns the equivalent expiration time in milliseconds for the given time.
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
Specs
expiry_time(pos_integer(), :second | :minute | :hour | :day) :: pos_integer()
Returns the equivalent expiration time in milliseconds for the given time.
Example
iex> Nebulex.Time.expiry_time(10, :second)
10000
iex> Nebulex.Time.expiry_time(10, :minute)
600000
iex> Nebulex.Time.expiry_time(1, :hour)
3600000
iex> Nebulex.Time.expiry_time(1, :day)
86400000 Specs
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> Nebulex.Time.now()
_milliseconds Specs
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