File 1224-inets-Remove-usage-of-erlang-now.patch of Package erlang

From 07906b7d9f1c2f72810d9ae12b38415cc3c1e86d Mon Sep 17 00:00:00 2001
From: Lars Thorsen <lars.thorsen@ericsson.com>
Date: Fri, 13 May 2016 08:26:58 +0200
Subject: [PATCH 1/2] [inets] Remove usage of erlang:now()

---
 lib/inets/src/ftp/ftp.erl                     |  4 +-
 lib/inets/src/inets_app/Makefile              |  3 +-
 lib/inets/src/inets_app/inets.app.src         |  1 -
 lib/inets/src/inets_app/inets_lib.erl         |  2 +-
 lib/inets/src/inets_app/inets_time_compat.erl | 72 ---------------------------
 lib/inets/src/tftp/tftp_logger.erl            |  4 +-
 lib/inets/src/tftp/tftp_sup.erl               |  4 +-
 7 files changed, 8 insertions(+), 82 deletions(-)
 delete mode 100644 lib/inets/src/inets_app/inets_time_compat.erl

diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl
index db6260c..c2ca511 100644
--- a/lib/inets/src/ftp/ftp.erl
+++ b/lib/inets/src/ftp/ftp.erl
@@ -1,7 +1,7 @@
 %%
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
@@ -2177,7 +2177,7 @@ handle_caller(#state{caller = {transfer_data, {Cmd, Bin, RemoteFile}}} =
 %% Connect to FTP server at Host (default is TCP port 21) 
 %% in order to establish a control connection.
 setup_ctrl_connection(Host, Port, Timeout, State) ->
-    MsTime = inets_time_compat:monotonic_time(),
+    MsTime = erlang:monotonic_time(),
     case connect(Host, Port, Timeout, State) of
 	{ok, IpFam, CSock} ->
 	    NewState = State#state{csock = {tcp, CSock}, ipfamily = IpFam},
diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile
index 1d870c1..eb0098d 100644
--- a/lib/inets/src/inets_app/Makefile
+++ b/lib/inets/src/inets_app/Makefile
@@ -49,7 +49,6 @@ MODULES = \
 	inets_sup \
 	inets_trace \
 	inets_lib \
-	inets_time_compat \
	inets_regexp
 
 INTERNAL_HRL_FILES = inets_internal.hrl
diff --git a/lib/inets/src/inets_app/inets.app.src b/lib/inets/src/inets_app/inets.app.src
index 5706a33..eb4be93 100644
--- a/lib/inets/src/inets_app/inets.app.src
+++ b/lib/inets/src/inets_app/inets.app.src
@@ -28,7 +28,6 @@
 	    inets_service,	                  
 	    inets_trace,
             inets_lib,
-            inets_time_compat,
 	    inets_regexp,
 
             %% FTP
diff --git a/lib/inets/src/inets_app/inets_lib.erl b/lib/inets/src/inets_app/inets_lib.erl
index 6e16f5e..8993be2 100644
--- a/lib/inets/src/inets_app/inets_lib.erl
+++ b/lib/inets/src/inets_app/inets_lib.erl
@@ -27,7 +27,7 @@
 %% Help function, elapsed milliseconds since T0
 millisec_passed({_,_,_} = T0 ) ->
     %% OTP 17 and earlier
-    timer:now_diff(inets_time_compat:timestamp(), T0) div 1000;
+    timer:now_diff(erlang:timestamp(), T0) div 1000;
 
 millisec_passed(T0) ->
     %% OTP 18
diff --git a/lib/inets/src/inets_app/inets_time_compat.erl b/lib/inets/src/inets_app/inets_time_compat.erl
deleted file mode 100644
index 475f068..0000000
--- a/lib/inets/src/inets_app/inets_time_compat.erl
+++ /dev/null
@@ -1,72 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2015-2015. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%% This module is created to be able to execute on ERTS versions both
-%% earlier and later than 7.0.
-
--module(inets_time_compat).
-
-%% We don't want warnings about the use of erlang:now/0 in
-%% this module.
--compile(nowarn_deprecated_function).
-
--export([monotonic_time/0,
-         timestamp/0,
-         unique_integer/0,
-         unique_integer/1]).
-
-monotonic_time() ->
-    try
-	erlang:monotonic_time()
-    catch
-	error:undef ->
-	    %% Use Erlang system time as monotonic time
-	    erlang_system_time_fallback()
-    end.
-
-timestamp() ->
-    try
-	erlang:timestamp()
-    catch
-	error:undef ->
-	    erlang:now()
-    end.
-
-unique_integer() ->
-    try
-	erlang:unique_integer()
-    catch
-	error:undef ->
-            erlang_system_time_fallback()
-    end.
-
-unique_integer(Modifiers) ->
-    try
-	erlang:unique_integer(Modifiers)
-    catch
-	error:badarg ->
-	    erlang:error(badarg, [Modifiers]);
-	error:undef ->
-            erlang_system_time_fallback()
-    end.
-
-erlang_system_time_fallback() ->
-    {MS, S, US} = erlang:now(),
-    (MS*1000000+S)*1000000+US.
diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl
index 5e5d1d5..a869958 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-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2016. All Rights Reserved.
 %% 
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ info_msg(Format, Data) ->
 %%-------------------------------------------------------------------
 
 add_timestamp(Format, Data) ->
-    Time = inets_time_compat:timestamp(),
+    Time = erlang: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]}.
diff --git a/lib/inets/src/tftp/tftp_sup.erl b/lib/inets/src/tftp/tftp_sup.erl
index 98b92cc..40b67c4 100644
--- a/lib/inets/src/tftp/tftp_sup.erl
+++ b/lib/inets/src/tftp/tftp_sup.erl
@@ -1,7 +1,7 @@
 %%
 %% %CopyrightBegin%
 %% 
-%% Copyright Ericsson AB 2005-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
 %% 
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ unique_name(Options) ->
 	{value, {_, Port}} when is_integer(Port), Port > 0 -> 
 	    {tftpd, Port};
 	_ ->
-	    {tftpd, inets_time_compat:unique_integer([positive])}
+	    {tftpd, erlang:unique_integer([positive])}
     end.
 
 default_kill_after() ->
-- 
2.1.4

openSUSE Build Service is sponsored by