This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Address clock change risks #71
Comments
I've dealt with this issue too but @Dexterp37 brought it to my attention recently re: webscience :) This all sounds reasonable to me on first read, I'll dig into a bit more this week to make sure I understand. |
jonathanmayer
added a commit
that referenced
this issue
May 4, 2021
Plus a couple bug fixes in the pageTransition click content script.
jonathanmayer
added a commit
that referenced
this issue
May 4, 2021
jonathanmayer
added a commit
that referenced
this issue
May 4, 2021
jonathanmayer
added a commit
that referenced
this issue
May 21, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
@rhelmer made the excellent point that we should think carefully about clock change risks. While a study extension is running, the system clock could change. That might be because of a user adjustment, or it might be because the operating system is synchronizing time (e.g., NTP) to account for clock skew.
After digging into this issue, it appears there are two different clocks we can use inside WebScience and study extensions.
new Date()
orDate.now()
). The upsides are that this clock is familiar to developers and typically accounts for skew on an ongoing basis (by default in major OSes). The downside is that this clock can change at any time, with no notice, while a study extension is running.performance.timeOrigin + performance.now()
). The upsides are that this clock is guaranteed to be monotonic from browser startup to shutdown, is unaffected by user clock adjustments, and typically accounts for skew with each browser startup. The downside is that this clock can reflect skew between browser startup and shutdown, introducing small timing errors for long-lived browsing sessions.Our current WebScience implementation uses the system clock for all timestamps, except that when a page visit starts through ordinary navigation we use the global monotonic clock.
A few possible paths forward:
Event.timeStamp
property is headed anyway. We could also make this approach easy to maintain, by implementing a convenience function for the global monotonic clock (e.g.,timing.now()
) and an ESLint rule to warn for system clock usage in WebScience or a study extension.pageManager
andpageTransition
, among other modules.pageManager
page visit start and stop timestamps), but it's not implausible.The text was updated successfully, but these errors were encountered: