Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Issue 1391323002: Emphasizes that TimeTicks::UnixEpoch() is only an estimate (Closed)

Created:
5 years, 2 months ago by charliea (OOO until 10-5)
Modified:
5 years, 2 months ago
Reviewers:
Lei Zhang, miu
CC:
chromium-reviews, danakj
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Emphasizes that TimeTicks::UnixEpoch() is only an estimate This is the case because of its implementation: - Use Time::Now() to determine the current distance to the Unix epoch - Subtract that distance from TimeTicks::Now(), giving you an approximation of that epoch in TimeTicks However, this can lead to strange situations: - If a system experiences a large NTP adjustment (say, after being offline for a while), then Time::Now() will immediately jump to the new time, whereas TimeTicks::Now() will very slightly speed up or slow down the clock until the monotonic clock matches what's thought to be the "correct" time. However, this means that for a 10 second NTP adjustment, calling TimeTicks::UnixEpoch() a second before the adjustment will yield a 10 second difference from calling it after the adjustment. - The same is true for when the user manually sets the clock. Any monotonic clock (those used for TimeTicks) is resistant to such user intervention, whereas any wall clock (used for Time) is usually not. Thus, calling TimeTicks::UnixEpoch() a second before such an adjustment will yield a vastly different epoch estimate than calling it after the adjustment. Both of these are somewhat surprising results for a TimeTicks function, as it's generally safe to assume that TimeTicks functions are immune to these strange jumps. Given all of this, I think TimeTicks::UnixEpoch() needed a slightly stronger warning about the fact that it's only an estimate. Committed: https://crrev.com/faa791f2960fb3933b5b8ebd0ca90f81d680ebb4 Cr-Commit-Position: refs/heads/master@{#352952}

Patch Set 1 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -6 lines) Patch
M base/time/time.h View 1 chunk +8 lines, -6 lines 0 comments Download

Messages

Total messages: 12 (4 generated)
charliea (OOO until 10-5)
5 years, 2 months ago (2015-10-07 17:43:26 UTC) #2
miu
lgtm Follow-up thoughts: I'm beginning to worry we were wrong to ever add this function, ...
5 years, 2 months ago (2015-10-07 17:57:17 UTC) #4
charliea (OOO until 10-5)
5 years, 2 months ago (2015-10-07 18:43:49 UTC) #6
Lei Zhang
lgtm
5 years, 2 months ago (2015-10-07 18:46:53 UTC) #7
charliea (OOO until 10-5)
On 2015/10/07 18:43:49, Charlie Andrews wrote: While I certainly agree that it can have some ...
5 years, 2 months ago (2015-10-07 18:48:24 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1391323002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1391323002/20001
5 years, 2 months ago (2015-10-07 19:58:15 UTC) #10
commit-bot: I haz the power
Committed patchset #1 (id:20001)
5 years, 2 months ago (2015-10-07 21:46:41 UTC) #11
commit-bot: I haz the power
5 years, 2 months ago (2015-10-07 21:47:52 UTC) #12
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/faa791f2960fb3933b5b8ebd0ca90f81d680ebb4
Cr-Commit-Position: refs/heads/master@{#352952}

Powered by Google App Engine
This is Rietveld 408576698