now_to_secs

This commit is contained in:
Feng Lee 2015-06-24 00:37:41 +08:00
parent 2ff78d7fc6
commit 34fc0fb157
1 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,8 @@
-export([apply_module_attributes/1, -export([apply_module_attributes/1,
all_module_attributes/1, all_module_attributes/1,
cancel_timer/1]). cancel_timer/1,
now_to_secs/0, now_to_secs/1]).
-export([integer_to_binary/1]). -export([integer_to_binary/1]).
@ -90,4 +91,9 @@ cancel_timer(Ref) ->
integer_to_binary(I) when is_integer(I) -> integer_to_binary(I) when is_integer(I) ->
list_to_binary(integer_to_list(I)). list_to_binary(integer_to_list(I)).
now_to_secs() ->
now_to_secs(os:timestamp()).
now_to_secs({MegaSecs, Secs, _MicroSecs}) ->
MegaSecs * 1000000 + Secs.