diff options
author | Björn Gustavsson <[email protected]> | 2015-06-05 10:19:23 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-06-05 10:19:23 +0200 |
commit | 24a161d8c479e70ad55ebac18cd92ecc41dd607c (patch) | |
tree | a8a820696df69100100d11e282cdde291303bc9a /lib/kernel/test/gen_tcp_misc_SUITE.erl | |
parent | ccb7207b8ee271048905ef9b11448f98c645d533 (diff) | |
parent | 34e019dc29044e6f3b8d256a20f4ca83a3ac24a7 (diff) | |
download | otp-24a161d8c479e70ad55ebac18cd92ecc41dd607c.tar.gz otp-24a161d8c479e70ad55ebac18cd92ecc41dd607c.tar.bz2 otp-24a161d8c479e70ad55ebac18cd92ecc41dd607c.zip |
Merge branch 'bjorn/kernel/cuddle-with-tests'
* bjorn/kernel/cuddle-with-tests:
Clean up rpc_SUITE:call_benchmark/1
Eliminate use of erlang:now/0 for generating random numbers
Eliminate use of erlang:now/0 for measuring time
Eliminate use of erlang:now/0 for generating unique node names
Diffstat (limited to 'lib/kernel/test/gen_tcp_misc_SUITE.erl')
-rw-r--r-- | lib/kernel/test/gen_tcp_misc_SUITE.erl | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index ba4acad2e7..4f0d7a7d50 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -1641,8 +1641,7 @@ so_priority(Config) when is_list(Config) -> %% Accept test utilities (suites are below) millis() -> - {A,B,C}=erlang:now(), - (A*1000000*1000)+(B*1000)+(C div 1000). + erlang:monotonic_time(milli_seconds). collect_accepts(0,_) -> []; collect_accepts(N,Tmo) -> @@ -2103,8 +2102,8 @@ send_timeout(Config) when is_list(Config) -> ok. mad_sender(S) -> - {_, _, USec} = now(), - case gen_tcp:send(S, integer_to_list(USec)) of + U = rand:uniform(1000000), + case gen_tcp:send(S, integer_to_list(U)) of ok -> mad_sender(S); Err -> @@ -2172,10 +2171,10 @@ get_max_diff() -> end. get_max_diff(Max) -> - T1 = millistamp(), + T1 = millis(), receive ok -> - Diff = millistamp() - T1, + Diff = millis() - T1, if Diff > Max -> get_max_diff(Diff); @@ -2183,7 +2182,7 @@ get_max_diff(Max) -> get_max_diff(Max) end; {error,timeout} -> - Diff = millistamp() - T1, + Diff = millis() - T1, if Diff > Max -> Diff; @@ -2324,10 +2323,6 @@ setup_active_timeout_sink(Timeout, AutoClose) -> {Loop,A,R,C}. -millistamp() -> - {Mega, Secs, Micros} = erlang:now(), - (Micros div 1000) + Secs * 1000 + Mega * 1000000000. - has_superfluous_schedulers() -> case {erlang:system_info(schedulers), erlang:system_info(logical_processors)} of |