From 1132117b38cfe33e770a0d5b1a782d48667427c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erland=20Sch=C3=B6nbeck?= Date: Thu, 5 Mar 2015 13:37:16 +0100 Subject: Use new time API and be back-compatible in inets Remove unused functions and removed redundant test --- lib/inets/src/tftp/tftp_logger.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/inets/src/tftp/tftp_logger.erl') diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl index 0c3620e665..aa449682ce 100644 --- a/lib/inets/src/tftp/tftp_logger.erl +++ b/lib/inets/src/tftp/tftp_logger.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. 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 @@ -84,7 +84,13 @@ info_msg(Format, Data) -> %%------------------------------------------------------------------- add_timestamp(Format, Data) -> - Now = {_MegaSecs, _Secs, _MicroSecs} = erlang:now(), + %% Adapt to new OTP 18 erlang time API and be back-compatible + Now = try + erlang:timestamp() + catch + error:undef -> + erlang:now() + end, {{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Now), %% {"~p-~s-~sT~s:~s:~sZ,~6.6.0w tftp: " ++ Format ++ "\n", %% [Y, t(Mo), t(D), t(H), t(Mi), t(S), MicroSecs | Data]}. -- cgit v1.2.3 From f4a774425a440caa912da71cfb8c0c70df4df69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erland=20Sch=C3=B6nbeck?= Date: Mon, 9 Mar 2015 11:16:01 +0100 Subject: Suppress deprecated warning on erlang:now/0 --- lib/inets/src/tftp/tftp_logger.erl | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/inets/src/tftp/tftp_logger.erl') diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl index aa449682ce..2066445ef7 100644 --- a/lib/inets/src/tftp/tftp_logger.erl +++ b/lib/inets/src/tftp/tftp_logger.erl @@ -18,6 +18,7 @@ %% %% -module(tftp_logger). +-compile([{nowarn_deprecated_function,{erlang,now,0}}]). %%------------------------------------------------------------------- %% Interface -- cgit v1.2.3 From 87ae700c7383b74b8ddade6bfe30481dcdc5b6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erland=20Sch=C3=B6nbeck?= Date: Fri, 13 Mar 2015 10:12:57 +0100 Subject: inets: Update comments --- lib/inets/src/tftp/tftp_logger.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/inets/src/tftp/tftp_logger.erl') diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl index 2066445ef7..104d6a91c6 100644 --- a/lib/inets/src/tftp/tftp_logger.erl +++ b/lib/inets/src/tftp/tftp_logger.erl @@ -85,7 +85,7 @@ info_msg(Format, Data) -> %%------------------------------------------------------------------- add_timestamp(Format, Data) -> - %% Adapt to new OTP 18 erlang time API and be back-compatible + %% Adapt to new OTP 18 erlang time API and be backwards compatible Now = try erlang:timestamp() catch -- cgit v1.2.3