Merge branch 'master' of github.com:emqtt/emqttd

This commit is contained in:
Feng 2016-01-25 19:34:34 +08:00
commit 33b5d3b3ef
2 changed files with 10 additions and 6 deletions

View File

@ -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).

View File

@ -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);