From fbaa0becc787e73fa539e0d497b0d74be27c9534 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Wed, 17 Dec 2014 22:18:27 +0100 Subject: Replace usage of erlang:now() with usage of new API --- lib/stdlib/doc/src/calendar.xml | 6 ++++-- lib/stdlib/doc/src/file_sorter.xml | 6 +++--- lib/stdlib/doc/src/random.xml | 9 ++++----- lib/stdlib/doc/src/timer.xml | 10 ++++++---- 4 files changed, 17 insertions(+), 14 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/calendar.xml b/lib/stdlib/doc/src/calendar.xml index e32a639b81..d8193a9ec2 100644 --- a/lib/stdlib/doc/src/calendar.xml +++ b/lib/stdlib/doc/src/calendar.xml @@ -270,7 +270,8 @@ Convert now to local date and time

This function returns local date and time converted from - the return value from erlang:now().

+ the return value from + erlang:timestamp/0.

@@ -279,7 +280,8 @@ Convert now to date and time

This function returns Universal Coordinated Time (UTC) - converted from the return value from erlang:now().

+ converted from the return value from + erlang:timestamp/0.

diff --git a/lib/stdlib/doc/src/file_sorter.xml b/lib/stdlib/doc/src/file_sorter.xml index 16572df3c5..c069333c29 100644 --- a/lib/stdlib/doc/src/file_sorter.xml +++ b/lib/stdlib/doc/src/file_sorter.xml @@ -105,9 +105,9 @@ file:get_cwd() is used instead. The names of temporary files are derived from the Erlang nodename (node()), the process identifier of the current Erlang - emulator (os:getpid()), and a timestamp - (erlang:now()); a typical name would be - fs_mynode@myhost_1763_1043_337000_266005.17, where + emulator (os:getpid()), and a unique integer + (erlang:unique_integer([positive])); a typical name would be + fs_mynode@myhost_1763_4711.17, where 17 is a sequence number. Existing files will be overwritten. Temporary files are deleted unless some uncaught EXIT signal occurs. diff --git a/lib/stdlib/doc/src/random.xml b/lib/stdlib/doc/src/random.xml index e001058e19..2cc621ffc3 100644 --- a/lib/stdlib/doc/src/random.xml +++ b/lib/stdlib/doc/src/random.xml @@ -70,12 +70,11 @@

Seeds random number generation with integer values in the process dictionary, and returns the old state.

-

One way of obtaining a seed is to use the BIF now/0:

+

One easy way of obtaining a unique value to seed with is to:

- ... - {A1,A2,A3} = now(), - random:seed(A1, A2, A3), - ... + random:seed(erlang:phash2([node()]), + erlang:monotonic_time(), + erlang:unique_integer())
diff --git a/lib/stdlib/doc/src/timer.xml b/lib/stdlib/doc/src/timer.xml index eca9a72d36..791a29689e 100644 --- a/lib/stdlib/doc/src/timer.xml +++ b/lib/stdlib/doc/src/timer.xml @@ -217,12 +217,14 @@ - Calculate time difference between now/0timestamps + Calculate time difference between timestamps In microseconds

Calculates the time difference Tdiff = T2 - T1 in - microseconds, where T1 and T2 probably - are timestamp tuples returned from erlang:now/0.

+ microseconds, where T1 and T2 + are timestamp tuples on the same format as returned from + erlang:timestamp/0, + or os:timestamp/0.

@@ -234,7 +236,7 @@ - Converts Minutesto Milliseconds. + Converts Minutes to Milliseconds.

Return the number of milliseconds in Minutes.

-- cgit v1.2.3