aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-03-13 17:55:34 +0100
committerAnders Svensson <[email protected]>2015-03-19 14:14:28 +0100
commitd43862545fcab2c976ecf30a0620ac971e16ba8e (patch)
tree45e6dc1e534eb90450a319c48248a45e1dbe4235 /lib/diameter/src/base
parenteae8ecd1fd2ba33b1c81d0c19605047e2f317eda (diff)
downloadotp-d43862545fcab2c976ecf30a0620ac971e16ba8e.tar.gz
otp-d43862545fcab2c976ecf30a0620ac971e16ba8e.tar.bz2
otp-d43862545fcab2c976ecf30a0620ac971e16ba8e.zip
Adapt to changes in time api
erlang:convert_time_resolution/3 has been renamed to convert_time_unit. erlang:time_resolution/0 has been removed: use new time resolution values instead.
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r--lib/diameter/src/base/diameter_lib.erl15
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 6dd1d5f6ed..4ffe69112d 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)).