Skip to content

Commit

Permalink
Update getCurrentTime
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Nov 9, 2020
1 parent d8a13be commit 5ea434b
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/scheduler/src/forks/SchedulerPostTaskOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,10 @@ import {

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

let getCurrentTime;
const hasPerformanceNow =
typeof performance === 'object' && typeof performance.now === 'function';

if (hasPerformanceNow) {
const localPerformance = performance;
getCurrentTime = () => localPerformance.now();
} else {
const localDate = Date;
const initialTime = localDate.now();
getCurrentTime = () => localDate.now() - initialTime;
const perf = window.performance;

function getCurrentTime() {
return perf.now();
}

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

0 comments on commit 5ea434b

Please sign in to comment.