summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Long <him@nathanmlong.com>2019-06-24 17:13:08 -0400
committerAndrea Leopardi <an.leopardi@gmail.com>2019-06-24 23:13:07 +0200
commit3c9ff7b1aea00667f32253ecafe4c6fea23982ff (patch)
treeac28a6f63b0e7d6105d0a784b25e6c88dac721d5
parent620f7f6877b9f412147c71f5737683b721abbc52 (diff)
downloadelixir-3c9ff7b1aea00667f32253ecafe4c6fea23982ff.tar.gz
More details about the :native time unit, from the Erlang docs (#9157)
[ci skip]
-rw-r--r--lib/elixir/lib/system.ex12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/elixir/lib/system.ex b/lib/elixir/lib/system.ex
index b4161b894..d43518031 100644
--- a/lib/elixir/lib/system.ex
+++ b/lib/elixir/lib/system.ex
@@ -910,10 +910,14 @@ defmodule System do
`convert_time_unit/3` accepts an additional time unit (other than the
ones in the `t: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. To determine what
- the `:native` unit amounts to in a system, you can call this function to
- convert 1 second to the `:native` time unit (i.e.,
- `System.convert_time_unit(1, :second, :native)`).
+ 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 can call this function to convert 1 second to the `:native`
+ time unit: `System.convert_time_unit(1, :second, :native)`.
"""
@spec convert_time_unit(integer, time_unit | :native, time_unit | :native) :: integer
def convert_time_unit(time, from_unit, to_unit) do