aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_test_support.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2015-03-11 09:41:11 +0100
committerRickard Green <[email protected]>2015-03-20 15:28:54 +0100
commita219c06f31e082449a1e001c051661370fa00a5d (patch)
tree0b99ba0aabbee1d970ffe48b7fe599b536382d1e /lib/common_test/test/ct_test_support.erl
parentd2c19c15b887d44b92fa36c5f49d7f2ff755f8ad (diff)
downloadotp-a219c06f31e082449a1e001c051661370fa00a5d.tar.gz
otp-a219c06f31e082449a1e001c051661370fa00a5d.tar.bz2
otp-a219c06f31e082449a1e001c051661370fa00a5d.zip
Replace all calls to now/0 in CT with new time API functions
Diffstat (limited to 'lib/common_test/test/ct_test_support.erl')
-rw-r--r--lib/common_test/test/ct_test_support.erl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl
index 746469584d..acec3bde1d 100644
--- a/lib/common_test/test/ct_test_support.erl
+++ b/lib/common_test/test/ct_test_support.erl
@@ -277,10 +277,13 @@ run_ct_run_test(Opts,Config) ->
Level = proplists:get_value(trace_level, Config),
test_server:format(Level, "~n[RUN #1] Calling ct:run_test(~p) on ~p~n",
[Opts, CTNode]),
- T0 = now(),
+
+ T0 = erlang:monotonic_time(),
CtRunTestResult = rpc:call(CTNode, ct, run_test, [Opts]),
+ T1 = erlang:monotonic_time(),
+ Elapsed = erlang:convert_time_unit(T1-T0, native, milli_seconds),
test_server:format(Level, "~n[RUN #1] Got return value ~p after ~p ms~n",
- [CtRunTestResult,trunc(timer:now_diff(now(), T0)/1000)]),
+ [CtRunTestResult,Elapsed]),
case rpc:call(CTNode, erlang, whereis, [ct_util_server]) of
undefined ->
ok;
@@ -303,10 +306,12 @@ run_ct_script_start(Opts, Config) ->
[common_test, run_test_start_opts, Opts1]),
test_server:format(Level, "[RUN #2] Calling ct_run:script_start() on ~p~n",
[CTNode]),
- T0 = now(),
+ T0 = erlang:monotonic_time(),
ExitStatus = rpc:call(CTNode, ct_run, script_start, []),
+ T1 = erlang:monotonic_time(),
+ Elapsed = erlang:convert_time_unit(T1-T0, native, milli_seconds),
test_server:format(Level, "[RUN #2] Got exit status value ~p after ~p ms~n",
- [ExitStatus,trunc(timer:now_diff(now(), T0)/1000)]),
+ [ExitStatus,Elapsed]),
ExitStatus.
check_result({_Ok,Failed,{_UserSkipped,_AutoSkipped}},1,_Opts)
@@ -398,7 +403,7 @@ ct_rpc({M,F,A}, Config) ->
%%%-----------------------------------------------------------------
%%% random_error/1
random_error(Config) when is_list(Config) ->
- random:seed(now()),
+ random:seed(os:timestamp()),
Gen = fun(0,_) -> ok; (N,Fun) -> Fun(N-1, Fun) end,
Gen(random:uniform(100), Gen),