aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-03-22 09:45:22 +0100
committerAnders Svensson <[email protected]>2015-03-22 09:45:22 +0100
commitd8d522251a7b8a1b3a69718e9328eb62acc9e22c (patch)
tree16cd7b5498b2da1de23647ae1fb2c9d8a65b6f37 /lib
parentc8859fae10da567e13a0090c6cc04f4de634dc73 (diff)
parent90f97f3e17acb63bfae2e07646cfaf098ed3dbdd (diff)
downloadotp-d8d522251a7b8a1b3a69718e9328eb62acc9e22c.tar.gz
otp-d8d522251a7b8a1b3a69718e9328eb62acc9e22c.tar.bz2
otp-d8d522251a7b8a1b3a69718e9328eb62acc9e22c.zip
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/src/base/diameter_lib.erl15
-rw-r--r--lib/diameter/test/diameter_app_SUITE.erl9
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/diameter/src/base/diameter_lib.erl b/lib/diameter/src/base/diameter_lib.erl
index b9defbd077..51d203d722 100644
--- a/lib/diameter/src/base/diameter_lib.erl
+++ b/lib/diameter/src/base/diameter_lib.erl
@@ -130,12 +130,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
%% ---------------------------------------------------------------------------
@@ -165,9 +166,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
@@ -179,9 +178,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)).
diff --git a/lib/diameter/test/diameter_app_SUITE.erl b/lib/diameter/test/diameter_app_SUITE.erl
index cf34c762e1..6975e83830 100644
--- a/lib/diameter/test/diameter_app_SUITE.erl
+++ b/lib/diameter/test/diameter_app_SUITE.erl
@@ -226,15 +226,18 @@ ignored({FromMod,_,_}, {ToMod,_,_} = To, Rel)->
%% New time api in OTP 18.
time_api() ->
- [{erlang, F, A} || {F,A} <- [{convert_time_resolution,3},
+ [{erlang, F, A} || {F,A} <- [{convert_time_unit,3},
{monotonic_time,0},
{monotonic_time,1},
+ {system_time,0},
+ {system_time,1},
{time_offset,0},
{time_offset,1},
- {time_resolution,0},
{timestamp,0},
{unique_integer,0},
- {unique_integer,1}]].
+ {unique_integer,1}]]
+ ++ [{os, system_time, 0},
+ {os, system_time, 1}].
release() ->
Rel = erlang:system_info(otp_release),