aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ftp/src/ftp.erl
diff options
context:
space:
mode:
authorPéter Dimitrov <[email protected]>2018-03-09 13:30:40 +0100
committerPéter Dimitrov <[email protected]>2018-03-28 10:19:38 +0200
commit99dada0ab68e663b26e24e2363c4613c36aa717f (patch)
tree80615bef0b359135df505d85ceae0aa753cc3336 /lib/ftp/src/ftp.erl
parent347a39468180c1410cedaee465821cfb10c2fcd7 (diff)
downloadotp-99dada0ab68e663b26e24e2363c4613c36aa717f.tar.gz
otp-99dada0ab68e663b26e24e2363c4613c36aa717f.tar.bz2
otp-99dada0ab68e663b26e24e2363c4613c36aa717f.zip
ftp: Remove references to inets
Change-Id: I19bd2f1d4a35cbc5c233ebc8b2a9d52bbd37f047
Diffstat (limited to 'lib/ftp/src/ftp.erl')
-rw-r--r--lib/ftp/src/ftp.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ftp/src/ftp.erl b/lib/ftp/src/ftp.erl
index e633c9343d..7b2bbfc164 100644
--- a/lib/ftp/src/ftp.erl
+++ b/lib/ftp/src/ftp.erl
@@ -32,7 +32,6 @@
]).
%% Added for backward compatibility
-%% Called by inets:start()
-export([start_standalone/1]).
-export([start_link/1, start_link/2]).
@@ -2082,7 +2081,7 @@ setup_ctrl_connection(Host, Port, Timeout, State) ->
{ok, IpFam, CSock} ->
NewState = State#state{csock = {tcp, CSock}, ipfamily = IpFam},
activate_ctrl_connection(NewState),
- case Timeout - inets_lib:millisec_passed(MsTime) of
+ case Timeout - millisec_passed(MsTime) of
Timeout2 when (Timeout2 >= 0) ->
{ok, NewState#state{caller = open}, Timeout2};
_ ->
@@ -2588,3 +2587,14 @@ validate_options([{Key, Value}|Options], ValidOptions, Acc) ->
end;
validate_options([_|Options], ValidOptions, Acc) ->
validate_options(Options, ValidOptions, Acc).
+
+%% Help function, elapsed milliseconds since T0
+millisec_passed({_,_,_} = T0 ) ->
+ %% OTP 17 and earlier
+ timer:now_diff(erlang:timestamp(), T0) div 1000;
+
+millisec_passed(T0) ->
+ %% OTP 18
+ erlang:convert_time_unit(erlang:monotonic_time() - T0,
+ native,
+ micro_seconds) div 1000.