aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/test/otp_SUITE.erl12
-rw-r--r--lib/ssh/src/ssh_info.erl10
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl29
3 files changed, 11 insertions, 40 deletions
diff --git a/erts/test/otp_SUITE.erl b/erts/test/otp_SUITE.erl
index ba71100081..1e42b5193c 100644
--- a/erts/test/otp_SUITE.erl
+++ b/erts/test/otp_SUITE.erl
@@ -95,8 +95,7 @@ undefined_functions(Config) when is_list(Config) ->
Undef5 = dialyzer_filter(Undef4),
Undef6 = wx_filter(Undef5),
Undef7 = gs_filter(Undef6),
- Undef8 = diameter_filter(Undef7),
- Undef = ssh_filter(Undef8),
+ Undef = diameter_filter(Undef7),
case Undef of
[] -> ok;
@@ -220,7 +219,7 @@ gs_filter(Undef) ->
end.
diameter_filter(Undef) ->
- %% Filter away function calls that are catched for OTP 18 time API
+ %% Filter away function calls that are catched.
filter(fun({{diameter_lib,_,_},{erlang,convert_time_resolution,3}}) ->
false;
({{diameter_lib,_,_},{erlang,monotonic_time,0}}) ->
@@ -234,13 +233,6 @@ diameter_filter(Undef) ->
(_) -> true
end, Undef).
-ssh_filter(Undef) ->
- %% Filter away function calls that are catched for OTP 18 time API
- filter(fun({{ssh_info,_,_},{erlang,timestamp,0}}) ->
- false;
- (_) -> true
- end, Undef).
-
deprecated_not_in_obsolete(Config) when is_list(Config) ->
?line Server = ?config(xref_server, Config),
?line {ok,DeprecatedFunctions} = xref:q(Server, "DF"),
diff --git a/lib/ssh/src/ssh_info.erl b/lib/ssh/src/ssh_info.erl
index e23ee836d5..9a91875894 100644
--- a/lib/ssh/src/ssh_info.erl
+++ b/lib/ssh/src/ssh_info.erl
@@ -25,7 +25,6 @@
-module(ssh_info).
-compile(export_all).
--compile([{nowarn_deprecated_function,{erlang,now,0}}]).
print() ->
try supervisor:which_children(ssh_sup)
@@ -180,14 +179,7 @@ line(Len, Char) ->
datetime() ->
- %% Adapt to new OTP 18 erlang time API and be back-compatible
- TimeStamp = try
- erlang:timestamp()
- catch
- error:undef ->
- erlang:now()
- end,
- {{YYYY,MM,DD}, {H,M,S}} = calendar:now_to_universal_time(TimeStamp),
+ {{YYYY,MM,DD}, {H,M,S}} = calendar:now_to_universal_time(now()),
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 945f615639..48a6627e0f 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -26,7 +26,6 @@
%% Note: This directive should only be used in test suites.
-compile(export_all).
--compile([{nowarn_deprecated_function,{erlang,now,0}}]).
-define(NEWLINE, <<"\r\n">>).
@@ -716,14 +715,7 @@ ssh_connect_arg4_timeout(_Config) ->
%% try to connect with a timeout, but "supervise" it
Client = spawn(fun() ->
- %% Adapt to OTP 18 erlang time API and be back-compatible
- T0 = try
- erlang:monotonic_time()
- catch
- error:undef ->
- %% Use Erlang system time as monotonic time
- erlang:now()
- end,
+ T0 = now(),
Rc = ssh:connect("localhost",Port,[],Timeout),
ct:log("Client ssh:connect got ~p",[Rc]),
Parent ! {done,self(),Rc,T0}
@@ -732,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),
+ Msp = ms_passed(T0, now()),
exit(Server,hasta_la_vista___baby),
Low = 0.9*Timeout,
High = 1.1*Timeout,
@@ -756,17 +748,12 @@ ssh_connect_arg4_timeout(_Config) ->
{fail, "Didn't timeout"}
end.
-
-%% Help function, elapsed milliseconds since T0
-ms_passed({_,_,_} = T0 ) ->
- %% OTP 17 and earlier
- timer:now_diff(erlang:now(), T0)/1000;
-
-ms_passed(T0) ->
- %% OTP 18
- erlang:convert_time_unit(erlang:monotonic_time() - T0,
- native,
- micro_seconds)/1000.
+%% 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).
%%--------------------------------------------------------------------
ssh_connect_negtimeout_parallel(Config) -> ssh_connect_negtimeout(Config,true).