mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Make misc:unique_timestamp not overflow microsecond part.
This should fix issue #2860
This commit is contained in:
parent
c96a925fde
commit
3706e35b86
@ -483,5 +483,6 @@ get_dir(Type) ->
|
|||||||
%% Generates erlang:timestamp() that is guaranteed to unique
|
%% Generates erlang:timestamp() that is guaranteed to unique
|
||||||
-spec unique_timestamp() -> erlang:timestamp().
|
-spec unique_timestamp() -> erlang:timestamp().
|
||||||
unique_timestamp() ->
|
unique_timestamp() ->
|
||||||
{MS, S, _} = erlang:timestamp(),
|
Time = erlang:system_time(microsecond),
|
||||||
{MS, S, erlang:unique_integer([positive, monotonic])}.
|
UI = erlang:unique_integer([positive, monotonic]),
|
||||||
|
usec_to_now(Time + UI).
|
||||||
|
Loading…
Reference in New Issue
Block a user