Skip to content

Commit fdb9a7e

Browse files
committed
ref(core): Strengthen browserPerformanceTimeOrigin reliability check
1 parent a6a4f7b commit fdb9a7e

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

packages/core/src/utils/time.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ function getBrowserTimeOrigin(): number | undefined {
8989
return undefined;
9090
}
9191

92-
// TOOD: We should probably set a much tighter threshold here as skew can already happen within just a few minutes.
93-
const threshold = 3_600_000; // 1 hour in milliseconds
92+
const threshold = 300_000; // 5 minutes in milliseconds
9493
const performanceNow = performance.now();
9594
const dateNow = Date.now();
9695

packages/core/test/lib/utils/time.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function getFreshPerformanceTimeOrigin() {
77
return timeModule.browserPerformanceTimeOrigin();
88
}
99

10-
const RELIABLE_THRESHOLD_MS = 3_600_000;
10+
const RELIABLE_THRESHOLD_MS = 300_000;
1111

1212
describe('browserPerformanceTimeOrigin', () => {
1313
it('returns `performance.timeOrigin` if it is available and reliable', async () => {

0 commit comments

Comments
 (0)