diff options
author | Micael Karlberg <[email protected]> | 2018-06-08 15:25:51 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:42:46 +0200 |
commit | 5b7ac9423f07171e4cd682a216cc86b1d32c660a (patch) | |
tree | f1b68e5162f18b5191c63fd6ac46f0109f240538 /erts/preloaded/src/net.erl | |
parent | 6b2c750c53a288d999c0f63dc6fe26a22d63ed00 (diff) | |
download | otp-5b7ac9423f07171e4cd682a216cc86b1d32c660a.tar.gz otp-5b7ac9423f07171e4cd682a216cc86b1d32c660a.tar.bz2 otp-5b7ac9423f07171e4cd682a216cc86b1d32c660a.zip |
[net-nif] The net-module now actually loads
The net (nif) module now actually loads (automatically)
when the VM is started (*on linux*).
Now we must make sure it *actually* works, and implement
the rest of the stuff...
Diffstat (limited to 'erts/preloaded/src/net.erl')
-rw-r--r-- | erts/preloaded/src/net.erl | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/erts/preloaded/src/net.erl b/erts/preloaded/src/net.erl index bdd81ea93a..f145797b97 100644 --- a/erts/preloaded/src/net.erl +++ b/erts/preloaded/src/net.erl @@ -131,7 +131,7 @@ on_load(Path, Extra) when is_list(Path) andalso is_map(Extra) -> on_load(true, _Path, _Extra) -> ok; on_load(false, Path, Extra) -> - ok = erlang:load_nif(Path, maps:put(timestamp, formated_timestamp(), Extra)). + ok = erlang:load_nif(Path, Extra). @@ -174,7 +174,7 @@ getnameinfo(SockAddr, Flags) when (is_record(SockAddr, in4_sockaddr) orelse is_record(SockAddr, in6_sockaddr)) andalso is_list(Flags) -> - nif_getnameinfo(SockAddr, EFlags). + nif_getnameinfo(SockAddr, Flags). %% =========================================================================== @@ -254,30 +254,30 @@ if_names() -> %% %% =========================================================================== -formated_timestamp() -> - format_timestamp(os:timestamp()). - -format_timestamp(Now) -> - N2T = fun(N) -> calendar:now_to_local_time(N) end, - format_timestamp(Now, N2T, true). - -format_timestamp({_N1, _N2, N3} = N, N2T, true) -> - FormatExtra = ".~.2.0w", - ArgsExtra = [N3 div 10000], - format_timestamp(N, N2T, FormatExtra, ArgsExtra); -format_timestamp({_N1, _N2, _N3} = N, N2T, false) -> - FormatExtra = "", - ArgsExtra = [], - format_timestamp(N, N2T, FormatExtra, ArgsExtra). - -format_timestamp(N, N2T, FormatExtra, ArgsExtra) -> - {Date, Time} = N2T(N), - {YYYY,MM,DD} = Date, - {Hour,Min,Sec} = Time, - FormatDate = - io_lib:format("~.4w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w" ++ FormatExtra, - [YYYY, MM, DD, Hour, Min, Sec] ++ ArgsExtra), - lists:flatten(FormatDate). +%% formated_timestamp() -> +%% format_timestamp(os:timestamp()). + +%% format_timestamp(Now) -> +%% N2T = fun(N) -> calendar:now_to_local_time(N) end, +%% format_timestamp(Now, N2T, true). + +%% format_timestamp({_N1, _N2, N3} = N, N2T, true) -> +%% FormatExtra = ".~.2.0w", +%% ArgsExtra = [N3 div 10000], +%% format_timestamp(N, N2T, FormatExtra, ArgsExtra); +%% format_timestamp({_N1, _N2, _N3} = N, N2T, false) -> +%% FormatExtra = "", +%% ArgsExtra = [], +%% format_timestamp(N, N2T, FormatExtra, ArgsExtra). + +%% format_timestamp(N, N2T, FormatExtra, ArgsExtra) -> +%% {Date, Time} = N2T(N), +%% {YYYY,MM,DD} = Date, +%% {Hour,Min,Sec} = Time, +%% FormatDate = +%% io_lib:format("~.4w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w" ++ FormatExtra, +%% [YYYY, MM, DD, Hour, Min, Sec] ++ ArgsExtra), +%% lists:flatten(FormatDate). %% =========================================================================== |