Skip to content

Commit 570d44b

Browse files
nathanlJosé Valim
authored andcommitted
More details about the :native time unit, from the Erlang docs (#9157)
[ci skip]
1 parent 71c335a commit 570d44b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/elixir/lib/system.ex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,10 +910,14 @@ defmodule System do
910910
`convert_time_unit/3` accepts an additional time unit (other than the
911911
ones in the `t:time_unit/0` type) called `:native`. `:native` is the time
912912
unit used by the Erlang runtime system. It's determined when the runtime
913-
starts and stays the same until the runtime is stopped. To determine what
914-
the `:native` unit amounts to in a system, you can call this function to
915-
convert 1 second to the `:native` time unit (i.e.,
916-
`System.convert_time_unit(1, :second, :native)`).
913+
starts and stays the same until the runtime is stopped, but could differ
914+
the next time the runtime is started on the same machine. For this reason,
915+
you should use this function to convert `:native` time units to a predictable
916+
unit before you display them to humans.
917+
918+
To determine how many seconds the `:native` unit represents in your current
919+
runtime, you can can call this function to convert 1 second to the `:native`
920+
time unit: `System.convert_time_unit(1, :second, :native)`.
917921
"""
918922
@spec convert_time_unit(integer, time_unit | :native, time_unit | :native) :: integer
919923
def convert_time_unit(time, from_unit, to_unit) do

0 commit comments

Comments
 (0)