New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 676836 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 587199



Sign in to add a comment

base::RepeatingTimer can drift, consider rescheduling by += delay instead of Now() + delay

Project Member Reported by gab@chromium.org, Dec 23 2016

Issue description

If a base::RepeatingTimer's scheduled task runs a few ms late, that drift will compound into the next scheduled task and so on. So say a timer is meant to fire every 10ms and there always is a 1ms extra delay before the task actually runs, the timer will run on [11, 22, 33, 44, 55, 66, 77, 88, 99] instead of [11, 21, 31, 41, 51, 61, 71, 81, 91].

alexclarke@ had addressed something similar in Blink IIRC

The solution is merely to |desired_run_time_ += delay_| instead of |desired_run_time_ = Now() + delay_|, not sure whether this can break tasks that explicitly expect not to be rescheduled for the full delay.
 

Comment 1 by gab@chromium.org, Dec 23 2016

Blockedon: 587199

Sign in to add a comment