Merge branch 'master' of github.com:emqtt/emqttd
This commit is contained in:
commit
33b5d3b3ef
|
@ -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).
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ len({pqueue, Queues}) ->
|
|||
|
||||
plen(0, {queue, _R, _F, L}) ->
|
||||
L;
|
||||
plen(P, {queue, _R, _F, _}) ->
|
||||
erlang:error(badarg, [P]);
|
||||
plen(_, {queue, _R, _F, _}) ->
|
||||
0;
|
||||
plen(P, {pqueue, Queues}) ->
|
||||
case lists:keysearch(maybe_negate_priority(P), 1, Queues) of
|
||||
{value, {_, Q}} -> len(Q);
|
||||
|
|
Loading…
Reference in New Issue