aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/diameter/src/base/diameter_lib.erl40
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl1
2 files changed, 6 insertions, 35 deletions
diff --git a/lib/diameter/src/base/diameter_lib.erl b/lib/diameter/src/base/diameter_lib.erl
index 3f327f3653..6a94e32b0e 100644
--- a/lib/diameter/src/base/diameter_lib.erl
+++ b/lib/diameter/src/base/diameter_lib.erl
@@ -102,8 +102,7 @@ fmt(T) ->
%% ---------------------------------------------------------------------------
-type timestamp() :: {non_neg_integer(), 0..999999, 0..999999}.
--type now() :: integer() %% monotonic time
- | timestamp().
+-type now() :: timestamp().
-spec now()
-> now().
@@ -112,11 +111,7 @@ fmt(T) ->
%% otherwise.
now() ->
- try
- erlang:monotonic_time()
- catch
- error: undef -> erlang:now()
- end.
+ erlang:now().
%% ---------------------------------------------------------------------------
%% # timestamp/1
@@ -126,15 +121,7 @@ now() ->
-> timestamp().
timestamp({_,_,_} = T) -> %% erlang:now()
- T;
-
-timestamp(MonoT) -> %% monotonic time
- 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).
+ T.
%% ---------------------------------------------------------------------------
%% # now_diff/1
@@ -162,10 +149,7 @@ now_diff(Time) ->
when MicroSecs :: non_neg_integer().
micro_diff({_,_,_} = T0) ->
- timer:now_diff(erlang:now(), T0);
-
-micro_diff(T0) -> %% monotonic time
- monotonic_to_microseconds(erlang:monotonic_time() - T0).
+ timer:now_diff(erlang:now(), T0).
%% ---------------------------------------------------------------------------
%% # micro_diff/2
@@ -175,12 +159,8 @@ micro_diff(T0) -> %% monotonic time
-> MicroSecs
when MicroSecs :: non_neg_integer().
-micro_diff(T1, T0)
- when is_integer(T1), is_integer(T0) -> %% monotonic time
- monotonic_to_microseconds(T1 - T0);
-
micro_diff(T1, T0) -> %% at least one erlang:now()
- timer:now_diff(timestamp(T1), timestamp(T0)).
+ timer:now_diff(T1, T0).
%% ---------------------------------------------------------------------------
%% # time/1
@@ -219,15 +199,7 @@ time(Micro) -> %% elapsed time
seed() ->
T = now(),
- {timestamp(T), seed(T)}.
-
-%% seed/1
-
-seed({_,_,_} = T) ->
- T;
-
-seed(T) -> %% monotonic time
- {erlang:phash2(node()), T, erlang:unique_integer()}.
+ {T, T}.
%% ---------------------------------------------------------------------------
%% # eval/1
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index 0607c72818..66781d7b06 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -66,7 +66,6 @@
parent = self() :: pid(), %% service process
transport :: pid() | undefined, %% peer_fsm process
tref :: reference() %% reference for current watchdog timer
- | integer() %% monotonic time
| tuple() %% now()
| undefined,
dictionary :: module(), %% common dictionary