Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Use Performance.now for interaction timings
Browse files Browse the repository at this point in the history
System clock changes during an interaction could skew the
results significantly.

Fixes #4054.
  • Loading branch information
jaredhirsch committed Feb 12, 2018
1 parent 7857d74 commit 3119bb4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/webextension/background/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ this.analytics = (function() {
if (anyMatches(r.cancel, action, label)) {
delete timingData[r.name];
} else if (match(r.start, action, label)) {
timingData[r.name] = Date.now();
timingData[r.name] = Math.round(performance.now());
} else if (timingData[r.name] && match(r.end, action, label)) {
const endTime = Date.now();
const endTime = Math.round(performance.now());
const elapsed = endTime - timingData[r.name];
sendTiming("perf-response-time", r.name, elapsed);
delete timingData[r.name];
Expand Down

0 comments on commit 3119bb4

Please sign in to comment.