aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server/src/test_server_sup.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-02-19 15:35:44 +0100
committerRickard Green <[email protected]>2015-03-20 15:28:53 +0100
commitd2c19c15b887d44b92fa36c5f49d7f2ff755f8ad (patch)
treeea16cd65612e10521b6b1402f0e6df591489b80a /lib/test_server/src/test_server_sup.erl
parentd6c23051e42928099fdcad4199bc89503ca6f2d9 (diff)
downloadotp-d2c19c15b887d44b92fa36c5f49d7f2ff755f8ad.tar.gz
otp-d2c19c15b887d44b92fa36c5f49d7f2ff755f8ad.tar.bz2
otp-d2c19c15b887d44b92fa36c5f49d7f2ff755f8ad.zip
test_server: Replace usage of erlang:now() with usage of new API
Diffstat (limited to 'lib/test_server/src/test_server_sup.erl')
-rw-r--r--lib/test_server/src/test_server_sup.erl15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/test_server/src/test_server_sup.erl b/lib/test_server/src/test_server_sup.erl
index 96e369a138..7a1f7803eb 100644
--- a/lib/test_server/src/test_server_sup.erl
+++ b/lib/test_server/src/test_server_sup.erl
@@ -121,14 +121,8 @@ messages_get(Msgs) ->
end.
timecall(M, F, A) ->
- Befor = erlang:now(),
- Val = apply(M, F, A),
- After = erlang:now(),
- Elapsed =
- (element(1,After)*1000000+element(2,After)+element(3,After)/1000000)-
- (element(1,Befor)*1000000+element(2,Befor)+element(3,Befor)/1000000),
- {Elapsed, Val}.
-
+ {Elapsed, Val} = timer:tc(M, F, A),
+ {Elapsed / 1000000, Val}.
call_crash(Time,Crash,M,F,A) ->
@@ -874,9 +868,8 @@ unique_name() ->
util_loop(State) ->
receive
{From,unique_name} ->
- {_,S,Us} = now(),
- Ms = trunc(Us/1000),
- Name = lists:flatten(io_lib:format("~w.~w", [S,Ms])),
+ Nr = erlang:unique_integer([positive]),
+ Name = integer_to_list(Nr),
if Name == State#util_state.latest_name ->
timer:sleep(1),
self() ! {From,unique_name},