Fix window.performance.now()

This commit is contained in:
Manish Goregaokar 2014-12-15 23:55:00 +05:30
parent 1bc2c8a639
commit eec68faa41
2 changed files with 4 additions and 3 deletions

View file

@ -47,9 +47,10 @@ impl<'a> PerformanceMethods for JSRef<'a, Performance> {
Temporary::new(self.timing.clone())
}
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime/Overview.html#dom-performance-now
fn Now(self) -> DOMHighResTimeStamp {
let navStart = self.timing.root().NavigationStartPrecise() as f64;
(time::precise_time_s() - navStart) as DOMHighResTimeStamp
let navStart = self.timing.root().NavigationStartPrecise();
(time::precise_time_ns() as f64 - navStart) * 1000000u as DOMHighResTimeStamp
}
}