aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test/httpd_time_test.erl
diff options
context:
space:
mode:
authorErland Schönbeck <[email protected]>2015-03-17 11:56:14 +0100
committerRickard Green <[email protected]>2015-03-20 15:28:54 +0100
commit7cdde7537deccd53d95d03860379f3d20ad2e265 (patch)
tree8d2c7cc5b86e6a57e840efcd781abe8067c9f614 /lib/inets/test/httpd_time_test.erl
parent87ae700c7383b74b8ddade6bfe30481dcdc5b6c7 (diff)
downloadotp-7cdde7537deccd53d95d03860379f3d20ad2e265.tar.gz
otp-7cdde7537deccd53d95d03860379f3d20ad2e265.tar.bz2
otp-7cdde7537deccd53d95d03860379f3d20ad2e265.zip
inets: Cleanup of multiple copies of functions
Add inets_lib with common functions used by multiple modules
Diffstat (limited to 'lib/inets/test/httpd_time_test.erl')
-rw-r--r--lib/inets/test/httpd_time_test.erl31
1 files changed, 11 insertions, 20 deletions
diff --git a/lib/inets/test/httpd_time_test.erl b/lib/inets/test/httpd_time_test.erl
index b2a2075520..b3e6746a01 100644
--- a/lib/inets/test/httpd_time_test.erl
+++ b/lib/inets/test/httpd_time_test.erl
@@ -117,7 +117,16 @@ main(N, SocketType, Host, Port, Time)
loop(Pollers, Timeout) ->
d("loop -> entry when"
"~n Timeout: ~p", [Timeout]),
- Start = t(),
+ %% Adapt to OTP 18 erlang time API and be backwards compatible
+ Start = try
+ erlang:monotonic_time(1000)
+ catch
+ error:undef ->
+ %% Use Erlang system time as monotonic time
+ {A,B,C} = erlang:now(),
+ A*1000000000+B*1000+(C div 1000)
+ end,
+
receive
{'EXIT', Pid, {poller_stat_failure, SocketType, Host, Port, Time, Reason}} ->
case is_poller(Pid, Pollers) of
@@ -134,7 +143,7 @@ loop(Pollers, Timeout) ->
false ->
error_msg("received unexpected ~p from ~p"
"befor completion of test", [Reason, Pid]),
- loop(Pollers, to(Timeout, Start))
+ loop(Pollers, Timeout - inets_lib:millisec_passed(Start))
end;
{poller_stat_failure, Pid, {SocketType, Host, Port, Time, Reason}} ->
@@ -477,24 +486,6 @@ status_to_message(Code) -> io_lib:format("Unknown status code: ~p",[Code]).
%% ----------------------------------------------------------------
-to(To, Start) ->
- To - (t() - Start).
-
-%% Time in milli seconds
-t() ->
- %% Adapt to OTP 18 erlang time API and be backwards compatible
- try
- erlang:monotonic_time(1000)
- catch
- error:undef ->
- %% Use Erlang system time as monotonic time
- {A,B,C} = erlang:now(),
- A*1000000000+B*1000+(C div 1000)
- end.
-
-
-%% ----------------------------------------------------------------
-
% close(Socket) ->