diff options
author | Anders Svensson <[email protected]> | 2015-02-10 08:44:35 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2015-02-20 02:26:53 +0100 |
commit | eae8ecd1fd2ba33b1c81d0c19605047e2f317eda (patch) | |
tree | c6dacca281e305e441a23b2fda3859cd5a623877 /lib/diameter/test/diameter_util.erl | |
parent | e6d19a18b7c1057c2b4493f8db822c82bb0dbe0d (diff) | |
download | otp-eae8ecd1fd2ba33b1c81d0c19605047e2f317eda.tar.gz otp-eae8ecd1fd2ba33b1c81d0c19605047e2f317eda.tar.bz2 otp-eae8ecd1fd2ba33b1c81d0c19605047e2f317eda.zip |
Use new time api in test suites
Where it's less important to do so, but it has to be done at some point
since erlang:now/0 is deprecated. As in the parent commit, continue to
use the old api if the new one is unavailable.
Diffstat (limited to 'lib/diameter/test/diameter_util.erl')
-rw-r--r-- | lib/diameter/test/diameter_util.erl | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index e95cbfceb5..c496876ee1 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -30,6 +30,9 @@ fold/3, foldl/3, scramble/1, + timestamp/0, + seed/0, + unique_string/0, have_sctp/0]). %% diameter-specific @@ -175,7 +178,7 @@ scramble(L) -> [[fun s/1, L]]). s(L) -> - random:seed(now()), + random:seed(seed()), s([], L). s(Acc, []) -> @@ -185,6 +188,31 @@ s(Acc, L) -> s([T|Acc], H ++ Rest). %% --------------------------------------------------------------------------- +%% timestamp/0 + +timestamp() -> + diameter_lib:timestamp(diameter_lib:now()). + +%% --------------------------------------------------------------------------- +%% seed/0 + +seed() -> + {_,T} = diameter_lib:seed(), + T. + +%% --------------------------------------------------------------------------- +%% unique_string/0 + +unique_string() -> + us(diameter_lib:now()). + +us({M,S,U}) -> + tl(lists:append(["-" ++ integer_to_list(N) || N <- [M,S,U]])); + +us(MonoT) -> + integer_to_list(MonoT). + +%% --------------------------------------------------------------------------- %% have_sctp/0 have_sctp() -> |