aboutsummaryrefslogtreecommitdiffstats
path: root/lib/orber/src/orber_objectkeys.erl
diff options
context:
space:
mode:
authorLars Thorsen <[email protected]>2015-05-08 12:41:17 +0200
committerLars Thorsen <[email protected]>2015-05-08 12:41:17 +0200
commit4c1326cff025c3757260063ce2ebac7ab2d76378 (patch)
tree3ceb52fc14d5211b2b78786d2e2117f6942f2491 /lib/orber/src/orber_objectkeys.erl
parent2e90dc9905de1e2817377fc2cfbd712ad8c802d0 (diff)
parent2a2d6181184ccde3bc929981eeee662203142238 (diff)
downloadotp-4c1326cff025c3757260063ce2ebac7ab2d76378.tar.gz
otp-4c1326cff025c3757260063ce2ebac7ab2d76378.tar.bz2
otp-4c1326cff025c3757260063ce2ebac7ab2d76378.zip
Merge branch 'lars/remove_now/OTP-12687'
* lars/remove_now/OTP-12687: [orber, cos*] Remove usage of erlang:now() in test suites [orber] Use rand instead of random [orber, cos*] Bump versions and update dependencies in app file [orber, cos*] Remove usage of erlang:now()
Diffstat (limited to 'lib/orber/src/orber_objectkeys.erl')
-rw-r--r--lib/orber/src/orber_objectkeys.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/orber/src/orber_objectkeys.erl b/lib/orber/src/orber_objectkeys.erl
index b0e759187b..f57b1d811f 100644
--- a/lib/orber/src/orber_objectkeys.erl
+++ b/lib/orber/src/orber_objectkeys.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -374,11 +374,11 @@ handle_call({register, Objkey, Pid, Type}, _From, State) ->
%% No key exists. Ok to register.
mnesia:write(#orber_objkeys{object_key=Objkey, pid=Pid,
persistent=Type,
- timestamp=now()});
+ timestamp=erlang:monotonic_time(seconds)});
[X] when X#orber_objkeys.persistent==true,
X#orber_objkeys.pid == dead ->
%% A persistent object is being restarted. Update Pid & time.
- mnesia:write(X#orber_objkeys{pid=Pid, timestamp=now()});
+ mnesia:write(X#orber_objkeys{pid=Pid, timestamp=erlang:monotonic_time(seconds)});
[X] when is_pid(X#orber_objkeys.pid) ->
%% Object exists, i.e., trying to create an object with
%% the same name.
@@ -477,7 +477,7 @@ handle_info({'EXIT', Pid, Reason}, State) when is_pid(Pid) ->
Reason /= normal andalso
Reason /= shutdown ->
mnesia:write(X#orber_objkeys{pid=dead,
- timestamp=now()});
+ timestamp=erlang:monotonic_time(seconds)});
[X] when X#orber_objkeys.persistent==true ->
mnesia:delete({orber_objkeys, X#orber_objkeys.object_key});
_->
@@ -503,8 +503,8 @@ code_change(_OldVsn, State, _Extra) ->
%% Internal Functions
%%-----------------------------------------------------------------
-timetest(S, {MeSec, Sec, USec}) ->
- {MeSec, Sec+S, USec} < now().
+timetest(S, TimeStamp) ->
+ TimeStamp+S < erlang:monotonic_time(seconds).
get_key_from_pid(Pid) ->
case mnesia:dirty_match_object({orber_objkeys, '_', Pid,'_','_'}) of