diff options
author | Anders Svensson <[email protected]> | 2015-03-22 09:45:03 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2015-03-22 09:45:03 +0100 |
commit | 581e3f40954e58f0fc2ec50fc43ecca08a8e4b09 (patch) | |
tree | 9eb905801caaf8d9305ac38c2839c59e9f4b86b7 /lib/diameter/src/base | |
parent | b4a9bc73058e9d934143d41e766722f3e3b3d758 (diff) | |
parent | d43862545fcab2c976ecf30a0620ac971e16ba8e (diff) | |
download | otp-581e3f40954e58f0fc2ec50fc43ecca08a8e4b09.tar.gz otp-581e3f40954e58f0fc2ec50fc43ecca08a8e4b09.tar.bz2 otp-581e3f40954e58f0fc2ec50fc43ecca08a8e4b09.zip |
Merge branch 'anders/diameter/time/OTP-12439' into maint
* anders/diameter/time/OTP-12439:
Adapt to changes in time api
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r-- | lib/diameter/src/base/diameter_lib.erl | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/diameter/src/base/diameter_lib.erl b/lib/diameter/src/base/diameter_lib.erl index d0d730f47c..3f327f3653 100644 --- a/lib/diameter/src/base/diameter_lib.erl +++ b/lib/diameter/src/base/diameter_lib.erl @@ -129,12 +129,13 @@ timestamp({_,_,_} = T) -> %% erlang:now() T; timestamp(MonoT) -> %% monotonic time - MicroSecs = erlang:convert_time_resolution(MonoT + erlang:time_offset(), - erlang:time_resolution(), - 1000000), + MicroSecs = monotonic_to_microseconds(MonoT + erlang:time_offset()), Secs = MicroSecs div 1000000, {Secs div 1000000, Secs rem 1000000, MicroSecs rem 1000000}. +monotonic_to_microseconds(MonoT) -> + erlang:convert_time_unit(MonoT, native, micro_seconds). + %% --------------------------------------------------------------------------- %% # now_diff/1 %% --------------------------------------------------------------------------- @@ -164,9 +165,7 @@ micro_diff({_,_,_} = T0) -> timer:now_diff(erlang:now(), T0); micro_diff(T0) -> %% monotonic time - erlang:convert_time_resolution(erlang:monotonic_time() - T0, - erlang:time_resolution(), - 1000000). + monotonic_to_microseconds(erlang:monotonic_time() - T0). %% --------------------------------------------------------------------------- %% # micro_diff/2 @@ -178,9 +177,7 @@ micro_diff(T0) -> %% monotonic time micro_diff(T1, T0) when is_integer(T1), is_integer(T0) -> %% monotonic time - erlang:convert_time_resolution(T1 - T0, - erlang:time_resolution(), - 1000000); + monotonic_to_microseconds(T1 - T0); micro_diff(T1, T0) -> %% at least one erlang:now() timer:now_diff(timestamp(T1), timestamp(T0)). |