aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2019-04-16 10:24:28 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2019-04-16 10:24:28 +0200
commit3706e35b863eccc9e86ec3db9ea1ad328f8006f6 (patch)
treeb38d546a431edeb2a60fe8dfb72baf61b5ee9582 /src
parentAdd hooks for tracking mucsub subscriptions changes (diff)
Make misc:unique_timestamp not overflow microsecond part.
This should fix issue #2860
Diffstat (limited to 'src')
-rw-r--r--src/misc.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/misc.erl b/src/misc.erl
index 891269cc1..c646ed442 100644
--- a/src/misc.erl
+++ b/src/misc.erl
@@ -483,5 +483,6 @@ get_dir(Type) ->
%% Generates erlang:timestamp() that is guaranteed to unique
-spec unique_timestamp() -> erlang:timestamp().
unique_timestamp() ->
- {MS, S, _} = erlang:timestamp(),
- {MS, S, erlang:unique_integer([positive, monotonic])}.
+ Time = erlang:system_time(microsecond),
+ UI = erlang:unique_integer([positive, monotonic]),
+ usec_to_now(Time + UI).