Skip to content

Commit 5ea434b

Browse files
committed
Update getCurrentTime
1 parent d8a13be commit 5ea434b

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/scheduler/src/forks/SchedulerPostTaskOnly.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,10 @@ import {
3939

4040
import {enableIsInputPending} from '../SchedulerFeatureFlags';
4141

42-
let getCurrentTime;
43-
const hasPerformanceNow =
44-
typeof performance === 'object' && typeof performance.now === 'function';
45-
46-
if (hasPerformanceNow) {
47-
const localPerformance = performance;
48-
getCurrentTime = () => localPerformance.now();
49-
} else {
50-
const localDate = Date;
51-
const initialTime = localDate.now();
52-
getCurrentTime = () => localDate.now() - initialTime;
42+
const perf = window.performance;
43+
44+
function getCurrentTime() {
45+
return perf.now();
5346
}
5447

5548
// Max 31 bit integer. The max integer size in V8 for 32-bit systems.

0 commit comments

Comments
 (0)