CHROMIUM: Allow larger continuity time jumps

Clock continuity is checked by maintaining a delta between
what is read from CLOCK_REALTIME and CLOCK_MONOTONIC_RAW.
This is very effective for a continuously powered machine.
For machines that are suspended and resumed, time jumps
occur frequently and will be the length of time that the
system was suspended.

The recently added CLOCK_BOOTTIME is meant to help applications
keep track of the time since boot, inclusive of suspend, but the
calculations that go into CLOCK_BOOTTIME may be subject to being
corrupted by RTC misbehavior, such as corruption upon return from
resume.

To limit the impact of time jumps from clock corruption upon resumption
without requiring a re-sync after every suspend, we set a more
reasonable upper limit.

To avoid expected time jumps from triggering simultaneous queries in
homogeneous environments, a jitter is introduced whenever the time
is being reset because of a desynchronization during an event.
(The jitter should match the maximum time of a check_continuity event.)

BUG=chromium:314679
TEST=doesn't immediately re-sync when returning from suspend (x86-alex)
     after time sync, date -s "5 hours", suspend, resume, see it note the de-sync.

Change-Id: I2d04fd46a63c420c4cd9a1e9ab5f09f148a1b027
Reviewed-on: https://chromium-review.googlesource.com/175431
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Will Drewry <wad@chromium.org>
Tested-by: Will Drewry <wad@chromium.org>
3 files changed