diff options
author | Erland Schönbeck <[email protected]> | 2015-02-25 10:52:56 +0100 |
---|---|---|
committer | Erland Schönbeck <[email protected]> | 2015-02-25 10:52:56 +0100 |
commit | af972aaf14a5f53510e692f48f672f7e6805ee6d (patch) | |
tree | 8c8700949048002920511ff3dc25fd4b124f1e9f /lib/ssh/src/ssh_info.erl | |
parent | 2032d22f69ffa8ce6c3ded5d2e2a6ff34b3b5980 (diff) | |
download | otp-af972aaf14a5f53510e692f48f672f7e6805ee6d.tar.gz otp-af972aaf14a5f53510e692f48f672f7e6805ee6d.tar.bz2 otp-af972aaf14a5f53510e692f48f672f7e6805ee6d.zip |
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.erl | 11 |
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])). |