Skip to content

Commit

Permalink
Switch to os:system_time/1
Browse files Browse the repository at this point in the history
Available since OTP 18
  • Loading branch information
martinsumner committed May 7, 2024
1 parent cf783ba commit 52af913
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/riak_core_stat_calc_proc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ cache_get(TS, TTL) ->
check_freshness(TStamp, TTL) ->
case (TStamp + TTL) > now_epoch() of
true ->
hit;
hit;
false ->
stale
end.
Expand All @@ -166,10 +166,10 @@ maybe_get_stat(_Stat, From, Pid, Awaiting) ->
do_calc_stat(Stat) ->
ServerPid = self(),
spawn_link(
fun() ->
StatVal = riak_core_stat_q:calc_stat(Stat),
gen_server:cast(ServerPid, {value, StatVal, now_epoch()}) end
).
fun() ->
StatVal = riak_core_stat_q:calc_stat(Stat),
gen_server:cast(ServerPid, {value, StatVal, now_epoch()}) end
).

maybe_tag_stale(Value) ->
case Value of
Expand All @@ -181,7 +181,4 @@ maybe_tag_stale(Value) ->
end.

now_epoch() ->
now_epoch(os:timestamp()).

now_epoch({Mega, Sec, _}) ->
(Mega * 1000000 + Sec).
os:system_time(seconds).

0 comments on commit 52af913

Please sign in to comment.