mh-two-thousand-and-two
2024-04-12 7fc6dbf547b8899d949b67cdec36b96a7d1701c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var now = require('./now');
var root = require('./root');
var performance = root.performance;
var process = root.process;
var loadTime;
if (performance && performance.now) {
    exports = function() {
        return performance.now();
    };
} else if (process && process.hrtime) {
    var getNanoSeconds = function() {
        var hr = process.hrtime();
        return hr[0] * 1e9 + hr[1];
    };
    loadTime = getNanoSeconds() - process.uptime() * 1e9;
    exports = function() {
        return (getNanoSeconds() - loadTime) / 1e6;
    };
} else {
    loadTime = now();
    exports = function() {
        return now() - loadTime;
    };
}
 
module.exports = exports;