aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorErland Schönbeck <[email protected]>2015-03-25 12:42:53 +0100
committerErland Schönbeck <[email protected]>2015-03-25 12:42:53 +0100
commita206e66f13471cdad02a966fcb569673e0938fa4 (patch)
treec712ca2b96a2fb1742c6598627f2bc349e2a5c8f /lib
parent1f3869b308af19fb9cf471a12b8a1fdeab9da290 (diff)
parent0fd30aa5c434dab38d0aa39a3ab7899c7e89dd9d (diff)
downloadotp-a206e66f13471cdad02a966fcb569673e0938fa4.tar.gz
otp-a206e66f13471cdad02a966fcb569673e0938fa4.tar.bz2
otp-a206e66f13471cdad02a966fcb569673e0938fa4.zip
Merge branch 'erland/ssh/OTP18/time_api/OTP-12444'
* erland/ssh/OTP18/time_api/OTP-12444: ssh: Use new time API
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/src/ssh_info.erl2
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl16
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/ssh/src/ssh_info.erl b/lib/ssh/src/ssh_info.erl
index 9a91875894..eae9ded5c6 100644
--- a/lib/ssh/src/ssh_info.erl
+++ b/lib/ssh/src/ssh_info.erl
@@ -179,7 +179,7 @@ line(Len, Char) ->
datetime() ->
- {{YYYY,MM,DD}, {H,M,S}} = calendar:now_to_universal_time(now()),
+ {{YYYY,MM,DD}, {H,M,S}} = calendar:now_to_universal_time(erlang:timestamp()),
lists:flatten(io_lib:format('~4w-~2..0w-~2..0w ~2..0w:~2..0w:~2..0w UTC',[YYYY,MM,DD, H,M,S])).
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index 48a6627e0f..4c5498dc0e 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -715,7 +715,7 @@ ssh_connect_arg4_timeout(_Config) ->
%% try to connect with a timeout, but "supervise" it
Client = spawn(fun() ->
- T0 = now(),
+ T0 = erlang:monotonic_time(),
Rc = ssh:connect("localhost",Port,[],Timeout),
ct:log("Client ssh:connect got ~p",[Rc]),
Parent ! {done,self(),Rc,T0}
@@ -724,7 +724,7 @@ ssh_connect_arg4_timeout(_Config) ->
%% Wait for client reaction on the connection try:
receive
{done, Client, {error,timeout}, T0} ->
- Msp = ms_passed(T0, now()),
+ Msp = ms_passed(T0),
exit(Server,hasta_la_vista___baby),
Low = 0.9*Timeout,
High = 1.1*Timeout,
@@ -748,12 +748,12 @@ ssh_connect_arg4_timeout(_Config) ->
{fail, "Didn't timeout"}
end.
-%% Help function
-%% N2-N1
-ms_passed(N1={_,_,M1}, N2={_,_,M2}) ->
- {0,{0,Min,Sec}} = calendar:time_difference(calendar:now_to_local_time(N1),
- calendar:now_to_local_time(N2)),
- 1000 * (Min*60 + Sec + (M2-M1)/1000000).
+%% Help function, elapsed milliseconds since T0
+ms_passed(T0) ->
+ %% OTP 18
+ erlang:convert_time_unit(erlang:monotonic_time() - T0,
+ native,
+ micro_seconds) / 1000.
%%--------------------------------------------------------------------
ssh_connect_negtimeout_parallel(Config) -> ssh_connect_negtimeout(Config,true).