aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorErland Schönbeck <[email protected]>2015-03-02 09:33:00 +0100
committerRickard Green <[email protected]>2015-03-20 15:28:54 +0100
commite4416aba1c71f3d5d02450ebe8d818493b984030 (patch)
tree7b262ed5e23a2be8ba1f951fb34a87623797dc4e /lib/ssh/src
parenta219c06f31e082449a1e001c051661370fa00a5d (diff)
downloadotp-e4416aba1c71f3d5d02450ebe8d818493b984030.tar.gz
otp-e4416aba1c71f3d5d02450ebe8d818493b984030.tar.bz2
otp-e4416aba1c71f3d5d02450ebe8d818493b984030.zip
Use new time API and be back-compatible in ssh
Conflicts: lib/ssh/test/ssh_basic_SUITE.erl
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh_info.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_info.erl b/lib/ssh/src/ssh_info.erl
index 9ed598b3ab..e23ee836d5 100644
--- a/lib/ssh/src/ssh_info.erl
+++ b/lib/ssh/src/ssh_info.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -25,6 +25,7 @@
-module(ssh_info).
-compile(export_all).
+-compile([{nowarn_deprecated_function,{erlang,now,0}}]).
print() ->
try supervisor:which_children(ssh_sup)
@@ -179,7 +180,14 @@ line(Len, Char) ->
datetime() ->
- {{YYYY,MM,DD}, {H,M,S}} = calendar:now_to_universal_time(now()),
+ %% 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),
lists:flatten(io_lib:format('~4w-~2..0w-~2..0w ~2..0w:~2..0w:~2..0w UTC',[YYYY,MM,DD, H,M,S])).