System.convert_time_unit
convert_time_unit
, go back to System module for more information.
Specs
Converts time
from time unit from_unit
to time unit to_unit
.
The result is rounded via the floor function.
convert_time_unit/3
accepts an additional time unit (other than the
ones in the time_unit/0
type) called :native
. :native
is the time
unit used by the Erlang runtime system. It's determined when the runtime
starts and stays the same until the runtime is stopped, but could differ
the next time the runtime is started on the same machine. For this reason,
you should use this function to convert :native
time units to a predictable
unit before you display them to humans.
To determine how many seconds the :native
unit represents in your current
runtime, you can call this function to convert 1 second to the :native
time unit: System.convert_time_unit(1, :second, :native)
.