add now_to_ms/0, now_to_ms/1 functions
This commit is contained in:
parent
f90dad9edb
commit
d8c116a502
|
@ -25,10 +25,8 @@
|
|||
%%%-----------------------------------------------------------------------------
|
||||
-module(emqttd_util).
|
||||
|
||||
-export([apply_module_attributes/1,
|
||||
all_module_attributes/1,
|
||||
cancel_timer/1,
|
||||
now_to_secs/0, now_to_secs/1]).
|
||||
-export([apply_module_attributes/1, all_module_attributes/1, cancel_timer/1,
|
||||
now_to_secs/0, now_to_secs/1, now_to_ms/0, now_to_ms/1]).
|
||||
|
||||
-export([integer_to_binary/1]).
|
||||
|
||||
|
@ -94,3 +92,9 @@ now_to_secs() ->
|
|||
now_to_secs({MegaSecs, Secs, _MicroSecs}) ->
|
||||
MegaSecs * 1000000 + Secs.
|
||||
|
||||
now_to_ms() ->
|
||||
now_to_ms(os:timestamp()).
|
||||
|
||||
now_to_ms({MegaSecs, Secs, MicroSecs}) ->
|
||||
(MegaSecs * 1000000 + Secs) * 1000 + round(MicroSecs/1000).
|
||||
|
||||
|
|
Loading…
Reference in New Issue