aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/tftp
diff options
context:
space:
mode:
authorErland Schönbeck <[email protected]>2015-03-24 13:52:07 +0100
committerErland Schönbeck <[email protected]>2015-03-24 13:52:07 +0100
commite10385909c687590d6522d007bba9d72f3f5c380 (patch)
tree51227978bac92c6eb5f94c4bc20c2b9b7d1c396e /lib/inets/src/tftp
parent487446e76102b27fa8df02a353c7fdeec2d091f1 (diff)
downloadotp-e10385909c687590d6522d007bba9d72f3f5c380.tar.gz
otp-e10385909c687590d6522d007bba9d72f3f5c380.tar.bz2
otp-e10385909c687590d6522d007bba9d72f3f5c380.zip
inets: Add new module inets_time_compat with new time API
The new module is backwards compatible.
Diffstat (limited to 'lib/inets/src/tftp')
-rw-r--r--lib/inets/src/tftp/tftp_logger.erl11
-rw-r--r--lib/inets/src/tftp/tftp_sup.erl13
2 files changed, 3 insertions, 21 deletions
diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl
index 104d6a91c6..231a705371 100644
--- a/lib/inets/src/tftp/tftp_logger.erl
+++ b/lib/inets/src/tftp/tftp_logger.erl
@@ -18,7 +18,6 @@
%%
%%
-module(tftp_logger).
--compile([{nowarn_deprecated_function,{erlang,now,0}}]).
%%-------------------------------------------------------------------
%% Interface
@@ -85,14 +84,8 @@ info_msg(Format, Data) ->
%%-------------------------------------------------------------------
add_timestamp(Format, Data) ->
- %% Adapt to new OTP 18 erlang time API and be backwards compatible
- Now = try
- erlang:timestamp()
- catch
- error:undef ->
- erlang:now()
- end,
- {{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Now),
+ Time = inets_time_compat:timestamp(),
+ {{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Time),
%% {"~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]}.
{"~s:~s:~s tftp: " ++ Format, [t(H), t(Mi), t(S) | Data]}.
diff --git a/lib/inets/src/tftp/tftp_sup.erl b/lib/inets/src/tftp/tftp_sup.erl
index 3065279515..7a0dcffc90 100644
--- a/lib/inets/src/tftp/tftp_sup.erl
+++ b/lib/inets/src/tftp/tftp_sup.erl
@@ -22,7 +22,6 @@
%%----------------------------------------------------------------------
-module(tftp_sup).
--compile([{nowarn_deprecated_function,{erlang,now,0}}]).
-behaviour(supervisor).
@@ -94,17 +93,7 @@ unique_name(Options) ->
{value, {_, Port}} when is_integer(Port), Port > 0 ->
{tftpd, Port};
_ ->
- {tftpd, unique_integer()}
- end.
-
-unique_integer() ->
- %% Adapt to OTP 18 erlang time API and be backwards compatible
- try
- erlang:unique_integer([positive])
- catch
- error:undef ->
- {MS, S, US} = erlang:now(),
- (MS*1000000+S)*1000000+US
+ {tftpd, inets_time_compat:unique_integer([positive])}
end.
default_kill_after() ->