From ffbb598a7348f4c156057bacce2f5a8956532a4e Mon Sep 17 00:00:00 2001 From: GilbertWong Date: Wed, 19 Jun 2019 16:09:59 +0800 Subject: [PATCH] Increase time precision for emqx_mod_presence --- src/emqx_mod_presence.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emqx_mod_presence.erl b/src/emqx_mod_presence.erl index cab5076f5..ef164102d 100644 --- a/src/emqx_mod_presence.erl +++ b/src/emqx_mod_presence.erl @@ -51,7 +51,7 @@ on_client_connected(#{client_id := ClientId, username => Username, ipaddress => iolist_to_binary(esockd_net:ntoa(IpAddr)), connack => ConnAck, - ts => os:system_time(second) + ts => erlang:system_time(millisecond) }) of {ok, Payload} -> emqx:publish(message(qos(Env), topic(connected, ClientId), Payload)); @@ -63,7 +63,7 @@ on_client_disconnected(#{client_id := ClientId, username := Username}, Reason, E case emqx_json:safe_encode([{clientid, ClientId}, {username, Username}, {reason, reason(Reason)}, - {ts, os:system_time(second)}]) of + {ts, erlang:system_time(millisecond)}]) of {ok, Payload} -> emqx_broker:publish(message(qos(Env), topic(disconnected, ClientId), Payload)); {error, Reason} ->