aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-04-19 10:53:07 +0200
committerFredrik Gustafsson <[email protected]>2013-04-19 10:53:07 +0200
commitb31b467e902c978284eaeca6a23e336d2301f42a (patch)
tree593332abaa8e420e4c1fe51a8f7804fe71129c5d
parent2e04fc33553703c17f2958dd7b02c22ba77322a0 (diff)
parent2403af917b62af85e06c3e26a4665ac3c173f533 (diff)
downloadotp-b31b467e902c978284eaeca6a23e336d2301f42a.tar.gz
otp-b31b467e902c978284eaeca6a23e336d2301f42a.tar.bz2
otp-b31b467e902c978284eaeca6a23e336d2301f42a.zip
Merge branch 'ak/fix-cpu-overhead-of-timer-server/OTP-11053' into maint
* ak/fix-cpu-overhead-of-timer-server/OTP-11053: fix excessive CPU consumption of timer_server
-rw-r--r--lib/stdlib/src/timer.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/stdlib/src/timer.erl b/lib/stdlib/src/timer.erl
index 689e42051f..e11fb046e9 100644
--- a/lib/stdlib/src/timer.erl
+++ b/lib/stdlib/src/timer.erl
@@ -354,7 +354,7 @@ timer_timeout(SysTime) ->
'$end_of_table' ->
infinity;
{Time, _Ref} when Time > SysTime ->
- Timeout = (Time - SysTime) div 1000,
+ Timeout = (Time - SysTime + 999) div 1000,
%% Returned timeout must fit in a small int
erlang:min(Timeout, ?MAX_TIMEOUT);
Key ->
@@ -414,7 +414,7 @@ next_timeout() ->
'$end_of_table' ->
infinity;
{Time, _} ->
- erlang:min(positive((Time - system_time()) div 1000), ?MAX_TIMEOUT)
+ erlang:min(positive((Time - system_time() + 999) div 1000), ?MAX_TIMEOUT)
end.
%% Help functions