diff options
author | Anders Svensson <[email protected]> | 2016-06-11 12:42:43 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2016-06-11 18:49:42 +0200 |
commit | c980e489d02417e1144d28958fe9abd4017f72a4 (patch) | |
tree | 0074bd849cc83e3f471cb0b89feae2d611ce6bc4 /lib/diameter/src/base/diameter_lib.erl | |
parent | f027ac4d0f1d522e3b3d5c4695baf42a5cdd5330 (diff) | |
download | otp-c980e489d02417e1144d28958fe9abd4017f72a4.tar.gz otp-c980e489d02417e1144d28958fe9abd4017f72a4.tar.bz2 otp-c980e489d02417e1144d28958fe9abd4017f72a4.zip |
Use rand(3) instead of random(3)
The latter is deprecated in OTP 19.
Diffstat (limited to 'lib/diameter/src/base/diameter_lib.erl')
-rw-r--r-- | lib/diameter/src/base/diameter_lib.erl | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/lib/diameter/src/base/diameter_lib.erl b/lib/diameter/src/base/diameter_lib.erl index 43b0ca24ab..b835e87967 100644 --- a/lib/diameter/src/base/diameter_lib.erl +++ b/lib/diameter/src/base/diameter_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -20,18 +20,17 @@ -module(diameter_lib). -compile({no_auto_import, [now/0]}). --compile({nowarn_deprecated_function, [{erlang, now, 0}]}). -export([info_report/2, error_report/2, warning_report/2, now/0, + timestamp/0, timestamp/1, now_diff/1, micro_diff/1, micro_diff/2, time/1, - seed/0, eval/1, eval_name/1, get_stacktrace/0, @@ -110,6 +109,16 @@ now() -> erlang:monotonic_time(). %% --------------------------------------------------------------------------- +%% # timestamp/0 +%% --------------------------------------------------------------------------- + +-spec timestamp() + -> erlang:timestamp(). + +timestamp() -> + timestamp(now()). + +%% --------------------------------------------------------------------------- %% # timestamp/1 %% --------------------------------------------------------------------------- @@ -184,24 +193,6 @@ time(Micro) -> %% elapsed time {H, M, S, Micro rem 1000000}. %% --------------------------------------------------------------------------- -%% # seed/0 -%% --------------------------------------------------------------------------- - --spec seed() - -> {erlang:timestamp(), {integer(), integer(), integer()}}. - -%% Return an argument for random:seed/1. - -seed() -> - T = now(), - {timestamp(T), seed(T)}. - -%% seed/1 - -seed(T) -> %% monotonic time - {erlang:phash2(node()), T, erlang:unique_integer()}. - -%% --------------------------------------------------------------------------- %% # eval/1 %% %% Evaluate a function in various forms. |