aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_info.erl
diff options
context:
space:
mode:
authorErland Schönbeck <[email protected]>2015-03-09 14:26:15 +0100
committerErland Schönbeck <[email protected]>2015-03-09 14:26:15 +0100
commit601ba7763892ddf81e4331962210771bdad04c82 (patch)
tree6f9f5071e0c90db4890853b6f94735d0852bb7af /lib/ssh/src/ssh_info.erl
parent07abc92d5c763cee81bf69695e35a658ddc961dc (diff)
parentaa8f4f23ee08281f06f11b80bbdb27bf1f279521 (diff)
downloadotp-601ba7763892ddf81e4331962210771bdad04c82.tar.gz
otp-601ba7763892ddf81e4331962210771bdad04c82.tar.bz2
otp-601ba7763892ddf81e4331962210771bdad04c82.zip
Merge branch 'erland/ssh/time/OTP-12444' into maint
* erland/ssh/time/OTP-12444: Update misleading comment in ssh_basic_SUITE Update new time API and be back-compatible in ssh Use new time API and be back-compatible in ssh otp_SUITE: Ignore undefined functions in ssh
Diffstat (limited to 'lib/ssh/src/ssh_info.erl')
-rw-r--r--lib/ssh/src/ssh_info.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_info.erl b/lib/ssh/src/ssh_info.erl
index 9ed598b3ab..e5a8666af0 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
@@ -179,7 +179,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])).