remove use of deprecated function erlang:now/0
This commit is contained in:
parent
e07d08333a
commit
7015ba2951
2 changed files with 6 additions and 6 deletions
|
@ -907,7 +907,7 @@ iso_test_() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
ms_test_() ->
|
ms_test_() ->
|
||||||
Now=now(),
|
Now=os:timestamp(),
|
||||||
[
|
[
|
||||||
?_assertEqual({{2012,12,12}, {12,12,12,1234}}, parse("2012-12-12T12:12:12.1234")),
|
?_assertEqual({{2012,12,12}, {12,12,12,1234}}, parse("2012-12-12T12:12:12.1234")),
|
||||||
?_assertEqual(format("H:m:s.f \\m \\i\\s \\m\\o\\n\\t\\h",?DATEMS),
|
?_assertEqual(format("H:m:s.f \\m \\i\\s \\m\\o\\n\\t\\h",?DATEMS),
|
||||||
|
|
|
@ -92,16 +92,16 @@ copy(From, To) ->
|
||||||
-spec md5sum(string() | binary()) -> string().
|
-spec md5sum(string() | binary()) -> string().
|
||||||
md5sum(Value) ->
|
md5sum(Value) ->
|
||||||
hex(binary_to_list(erlang:md5(Value))).
|
hex(binary_to_list(erlang:md5(Value))).
|
||||||
|
|
||||||
%% @doc return an sha1sum checksum string or a binary. Same as unix utility of
|
%% @doc return an sha1sum checksum string or a binary. Same as unix utility of
|
||||||
%% same name.
|
%% same name.
|
||||||
-ifdef(deprecated_crypto).
|
-ifdef(deprecated_crypto).
|
||||||
-spec sha1sum(string() | binary()) -> string().
|
-spec sha1sum(string() | binary()) -> string().
|
||||||
sha1sum(Value) ->
|
sha1sum(Value) ->
|
||||||
hex(binary_to_list(crypto:sha(Value))).
|
hex(binary_to_list(crypto:sha(Value))).
|
||||||
-else.
|
-else.
|
||||||
-spec sha1sum(string() | binary()) -> string().
|
-spec sha1sum(string() | binary()) -> string().
|
||||||
sha1sum(Value) ->
|
sha1sum(Value) ->
|
||||||
hex(binary_to_list(crypto:hash(sha, Value))).
|
hex(binary_to_list(crypto:hash(sha, Value))).
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ real_dir_path(Path) ->
|
||||||
%% function of the same name.
|
%% function of the same name.
|
||||||
-spec insecure_mkdtemp() -> TmpDirPath::file:name().
|
-spec insecure_mkdtemp() -> TmpDirPath::file:name().
|
||||||
insecure_mkdtemp() ->
|
insecure_mkdtemp() ->
|
||||||
random:seed(now()),
|
random:seed(os:timestamp()),
|
||||||
UniqueNumber = erlang:integer_to_list(erlang:trunc(random:uniform() * 1000000000000)),
|
UniqueNumber = erlang:integer_to_list(erlang:trunc(random:uniform() * 1000000000000)),
|
||||||
TmpDirPath =
|
TmpDirPath =
|
||||||
filename:join([tmp(), lists:flatten([".tmp_dir", UniqueNumber])]),
|
filename:join([tmp(), lists:flatten([".tmp_dir", UniqueNumber])]),
|
||||||
|
@ -336,7 +336,7 @@ setup_test() ->
|
||||||
|
|
||||||
md5sum_test() ->
|
md5sum_test() ->
|
||||||
?assertMatch("cfcd208495d565ef66e7dff9f98764da", md5sum("0")).
|
?assertMatch("cfcd208495d565ef66e7dff9f98764da", md5sum("0")).
|
||||||
|
|
||||||
sha1sum_test() ->
|
sha1sum_test() ->
|
||||||
?assertMatch("b6589fc6ab0dc82cf12099d1c2d40ab994e8410c", sha1sum("0")).
|
?assertMatch("b6589fc6ab0dc82cf12099d1c2d40ab994e8410c", sha1sum("0")).
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue