Use system_time/1 instead of monotonic_time/1

The value of monotonic_time/1 may differ significantly between
nodes in a cluster due to different erlang:time_offset/0 values.

Thanks to Christoph Scholz for spotting this
This commit is contained in:
Evgeny Khramtsov 2019-06-06 21:26:50 +03:00
parent 6c0d6f0774
commit 80b7d50628
2 changed files with 2 additions and 2 deletions

View File

@ -744,7 +744,7 @@ get_room_disco_item({Name, Host, Pid},
{get_disco_item, Filter, JID, Lang}) ->
RoomJID = jid:make(Name, Host),
Timeout = 100,
Time = erlang:monotonic_time(millisecond),
Time = erlang:system_time(millisecond),
Query1 = {get_disco_item, Filter, JID, Lang, Time+Timeout},
try p1_fsm:sync_send_all_state_event(Pid, Query1, Timeout) of
{item, Desc} ->

View File

@ -521,7 +521,7 @@ handle_sync_event({get_disco_item, Filter, JID, Lang, Time}, _From, StateName, S
false ->
false
end,
CurrentTime = erlang:monotonic_time(millisecond),
CurrentTime = erlang:system_time(millisecond),
if CurrentTime < Time ->
{reply, Reply, StateName, StateData};
true ->