@peerbit/time 2.0.5 → 2.0.6-a4f88b6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -2
- package/dist/src/hrtime.browser.d.ts +6 -0
- package/dist/src/hrtime.browser.d.ts.map +1 -0
- package/{lib/esm/hrtime.js → dist/src/hrtime.browser.js} +5 -28
- package/dist/src/hrtime.browser.js.map +1 -0
- package/dist/src/hrtime.d.ts +4 -0
- package/dist/src/hrtime.d.ts.map +1 -0
- package/dist/src/hrtime.js +3 -0
- package/dist/src/hrtime.js.map +1 -0
- package/{lib/esm → dist/src}/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -0
- package/{lib/esm → dist/src}/index.js +1 -1
- package/{lib/esm → dist/src}/index.js.map +1 -1
- package/{lib/esm → dist/src}/metrics.d.ts +1 -0
- package/dist/src/metrics.d.ts.map +1 -0
- package/{lib/esm → dist/src}/metrics.js +1 -1
- package/dist/src/metrics.js.map +1 -0
- package/{lib/esm → dist/src}/wait.d.ts +1 -0
- package/dist/src/wait.d.ts.map +1 -0
- package/package.json +59 -31
- package/src/hrtime.browser.ts +51 -0
- package/src/hrtime.ts +2 -78
- package/src/index.ts +1 -1
- package/src/metrics.ts +1 -1
- package/lib/esm/hrtime.d.ts +0 -5
- package/lib/esm/hrtime.js.map +0 -1
- package/lib/esm/metrics.js.map +0 -1
- /package/{lib/esm → dist/src}/wait.js +0 -0
- /package/{lib/esm → dist/src}/wait.js.map +0 -0
package/LICENSE
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.browser.d.ts","sourceRoot":"","sources":["../../src/hrtime.browser.ts"],"names":[],"mappings":"AA4BA,QAAA,MAAM,MAAM;yBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;kBAiB/C,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;CAFhD,CAAC;AAOF,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -24,27 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
24
24
|
SOFTWARE.
|
|
25
25
|
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
28
|
-
// based on https://gist.github.com/paulirish/5438650 copyright Paul Irish 2015.
|
|
29
|
-
if ("performance" in window === false) {
|
|
30
|
-
window.performance = {};
|
|
31
|
-
}
|
|
32
|
-
Date.now =
|
|
33
|
-
Date.now ||
|
|
34
|
-
(() => {
|
|
35
|
-
// thanks IE8
|
|
36
|
-
return new Date().getTime();
|
|
37
|
-
});
|
|
38
|
-
if ("now" in window.performance === false) {
|
|
39
|
-
let nowOffset = Date.now();
|
|
40
|
-
if (performance.timeOrigin) {
|
|
41
|
-
nowOffset = performance.timeOrigin;
|
|
42
|
-
}
|
|
43
|
-
window.performance["now"] = () => Date.now() - nowOffset;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const _hrtime = (previousTimestamp) => {
|
|
47
|
-
_perfomancePolyfill();
|
|
27
|
+
const hrtime = (previousTimestamp) => {
|
|
48
28
|
const baseNow = Math.floor((Date.now() - performance.now()) * 1e-3);
|
|
49
29
|
const clocktime = performance.now() * 1e-3;
|
|
50
30
|
let seconds = Math.floor(clocktime) + baseNow;
|
|
@@ -60,12 +40,9 @@ const _hrtime = (previousTimestamp) => {
|
|
|
60
40
|
return [seconds, nanoseconds];
|
|
61
41
|
};
|
|
62
42
|
const NS_PER_SEC = 1e9;
|
|
63
|
-
|
|
64
|
-
const diff =
|
|
43
|
+
hrtime.bigint = (time) => {
|
|
44
|
+
const diff = hrtime(time);
|
|
65
45
|
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
66
46
|
};
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
? _hrtime
|
|
70
|
-
: process.hrtime;
|
|
71
|
-
//# sourceMappingURL=hrtime.js.map
|
|
47
|
+
export { hrtime };
|
|
48
|
+
//# sourceMappingURL=hrtime.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.browser.js","sourceRoot":"","sources":["../../src/hrtime.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBE;AAGF,MAAM,MAAM,GAAG,CAAC,iBAAoC,EAAoB,EAAE;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;IAC9C,IAAI,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAEpD,IAAI,iBAAiB,EAAE,CAAC;QACvB,OAAO,GAAG,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACzC,WAAW,GAAG,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;YACV,WAAW,IAAI,GAAG,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,CAAC,MAAM,GAAG,CAAC,IAAuB,EAAU,EAAE;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.d.ts","sourceRoot":"","sources":["../../src/hrtime.ts"],"names":[],"mappings":";AAAA,QAAA,MAAM,MAAM,eAAiB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.js","sourceRoot":"","sources":["../../src/hrtime.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAKpB,QAAQ,CAAC,GAAG;IAJxB,OAAO,CAAC,MAAM,CAAS;IAEvB,KAAK,SAAK;gBAEW,GAAG,SAAK;IAG7B,GAAG,CAAC,MAAM,EAAE,MAAM;CAWlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,oBAAoB;IAKX;IAJb,MAAM,CAAS;IAEvB,KAAK,GAAG,CAAC,CAAC;IAEV,YAAqB,MAAM,EAAE;QAAR,QAAG,GAAH,GAAG,CAAK;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IACD,GAAG,CAAC,MAAc;QACjB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACf,IAAI,GAAG,CAAC,CAAC,CAAC,oCAAoC;QAC/C,CAAC;QACD,MAAM,EAAE,GAAG,IAAI,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IACnE,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;gBAC1B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED,qBAAa,UAAW,SAAQ,KAAK;gBACxB,OAAO,CAAC,EAAE,MAAM;CAG5B;AACD,eAAO,MAAM,KAAK,OAAQ,MAAM,YAAY;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,kBAYnE,CAAC;AASF,eAAO,MAAM,OAAO,UACf,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,YACf;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,KACC,QAAQ,CAAC,GAAG,SAAS,CAsBvB,CAAC;AAEF,eAAO,MAAM,eAAe,UACvB,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,YACf;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,KACC,QAAQ,CAAC,CA8BX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,61 @@
|
|
|
1
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"name": "@peerbit/time",
|
|
3
|
+
"version": "2.0.6-a4f88b6",
|
|
4
|
+
"description": "Utility functions for time",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"*": [
|
|
11
|
+
"*",
|
|
12
|
+
"dist/*",
|
|
13
|
+
"dist/src/*",
|
|
14
|
+
"dist/src/*/index"
|
|
15
|
+
],
|
|
16
|
+
"src/*": [
|
|
17
|
+
"*",
|
|
18
|
+
"dist/*",
|
|
19
|
+
"dist/src/*",
|
|
20
|
+
"dist/src/*/index"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/test",
|
|
28
|
+
"!**/*.tsbuildinfo"
|
|
29
|
+
],
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/src/index.d.ts",
|
|
33
|
+
"import": "./dist/src/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"eslintConfig": {
|
|
37
|
+
"extends": "ipfs",
|
|
38
|
+
"parserOptions": {
|
|
39
|
+
"project": true,
|
|
40
|
+
"sourceType": "module"
|
|
41
|
+
},
|
|
42
|
+
"ignorePatterns": [
|
|
43
|
+
"!.aegir.js",
|
|
44
|
+
"test/ts-use",
|
|
45
|
+
"*.d.ts"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"browser": {
|
|
49
|
+
"./dist/src/hrtime.js": "./dist/src/hrtime.browser.js"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"clean": "aegir clean",
|
|
56
|
+
"build": "aegir build --no-bundle",
|
|
57
|
+
"test": "aegir test"
|
|
58
|
+
},
|
|
59
|
+
"author": "dao.xyz",
|
|
60
|
+
"license": "MIT"
|
|
33
61
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2020 Vlad Tansky
|
|
6
|
+
Copyright (c) 2022 dao.xyz
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const hrtime = (previousTimestamp?: [number, number]): [number, number] => {
|
|
30
|
+
const baseNow = Math.floor((Date.now() - performance.now()) * 1e-3);
|
|
31
|
+
const clocktime = performance.now() * 1e-3;
|
|
32
|
+
let seconds = Math.floor(clocktime) + baseNow;
|
|
33
|
+
let nanoseconds = Math.floor((clocktime % 1) * 1e9);
|
|
34
|
+
|
|
35
|
+
if (previousTimestamp) {
|
|
36
|
+
seconds = seconds - previousTimestamp[0];
|
|
37
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
38
|
+
if (nanoseconds < 0) {
|
|
39
|
+
seconds--;
|
|
40
|
+
nanoseconds += 1e9;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return [seconds, nanoseconds];
|
|
44
|
+
};
|
|
45
|
+
const NS_PER_SEC = 1e9;
|
|
46
|
+
hrtime.bigint = (time?: [number, number]): bigint => {
|
|
47
|
+
const diff = hrtime(time);
|
|
48
|
+
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { hrtime }
|
package/src/hrtime.ts
CHANGED
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2020 Vlad Tansky
|
|
6
|
-
Copyright (c) 2022 dao.xyz
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
SOFTWARE.
|
|
25
|
-
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const _perfomancePolyfill = () => {
|
|
29
|
-
// based on https://gist.github.com/paulirish/5438650 copyright Paul Irish 2015.
|
|
30
|
-
if ("performance" in window === false) {
|
|
31
|
-
((window as any).performance as any) = {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
Date.now =
|
|
35
|
-
Date.now ||
|
|
36
|
-
(() => {
|
|
37
|
-
// thanks IE8
|
|
38
|
-
return new Date().getTime();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if ("now" in window.performance === false) {
|
|
42
|
-
let nowOffset = Date.now();
|
|
43
|
-
|
|
44
|
-
if (performance.timeOrigin) {
|
|
45
|
-
nowOffset = performance.timeOrigin;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
(window.performance as any)["now"] = () => Date.now() - nowOffset;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const _hrtime = (previousTimestamp?: [number, number]): [number, number] => {
|
|
53
|
-
_perfomancePolyfill();
|
|
54
|
-
const baseNow = Math.floor((Date.now() - performance.now()) * 1e-3);
|
|
55
|
-
const clocktime = performance.now() * 1e-3;
|
|
56
|
-
let seconds = Math.floor(clocktime) + baseNow;
|
|
57
|
-
let nanoseconds = Math.floor((clocktime % 1) * 1e9);
|
|
58
|
-
|
|
59
|
-
if (previousTimestamp) {
|
|
60
|
-
seconds = seconds - previousTimestamp[0];
|
|
61
|
-
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
62
|
-
if (nanoseconds < 0) {
|
|
63
|
-
seconds--;
|
|
64
|
-
nanoseconds += 1e9;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return [seconds, nanoseconds];
|
|
68
|
-
};
|
|
69
|
-
const NS_PER_SEC = 1e9;
|
|
70
|
-
_hrtime.bigint = (time?: [number, number]): bigint => {
|
|
71
|
-
const diff = _hrtime(time);
|
|
72
|
-
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default typeof process === "undefined" ||
|
|
76
|
-
typeof process.hrtime === "undefined"
|
|
77
|
-
? _hrtime
|
|
78
|
-
: process.hrtime;
|
|
1
|
+
const hrtime = process.hrtime;
|
|
2
|
+
export { hrtime }
|
package/src/index.ts
CHANGED
package/src/metrics.ts
CHANGED
package/lib/esm/hrtime.d.ts
DELETED
package/lib/esm/hrtime.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hrtime.js","sourceRoot":"","sources":["../../src/hrtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBE;AAEF,MAAM,mBAAmB,GAAG,GAAG,EAAE;IAChC,gFAAgF;IAChF,IAAI,aAAa,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrC,MAAc,CAAC,WAAmB,GAAG,EAAE,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,GAAG;QACP,IAAI,CAAC,GAAG;YACR,CAAC,GAAG,EAAE;gBACL,aAAa;gBACb,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;IAEJ,IAAI,KAAK,IAAI,MAAM,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;QAC3C,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE3B,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;YAC5B,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC;QACpC,CAAC;QAEA,MAAM,CAAC,WAAmB,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACnE,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,iBAAoC,EAAoB,EAAE;IAC1E,mBAAmB,EAAE,CAAC;IACtB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;IAC9C,IAAI,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAEpD,IAAI,iBAAiB,EAAE,CAAC;QACvB,OAAO,GAAG,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACzC,WAAW,GAAG,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;YACV,WAAW,IAAI,GAAG,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,OAAO,CAAC,MAAM,GAAG,CAAC,IAAuB,EAAU,EAAE;IACpD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,OAAO,OAAO,KAAK,WAAW;IAC7C,OAAO,OAAO,CAAC,MAAM,KAAK,WAAW;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC"}
|
package/lib/esm/metrics.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,OAAO,oBAAoB;IAKX;IAJb,MAAM,CAAS;IAEvB,KAAK,GAAG,CAAC,CAAC;IAEV,YAAqB,MAAM,EAAE;QAAR,QAAG,GAAH,GAAG,CAAK;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IACD,GAAG,CAAC,MAAc;QACjB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACf,IAAI,GAAG,CAAC,CAAC,CAAC,oCAAoC;QAC/C,CAAC;QACD,MAAM,EAAE,GAAG,IAAI,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IACnE,CAAC;CACD"}
|
|
File without changes
|
|
File without changes
|