convert-hrtime
Advanced tools
Comparing version 4.0.0 to 5.0.0
export interface HighResolutionTime { | ||
seconds: bigint; | ||
milliseconds: bigint; | ||
seconds: number; | ||
milliseconds: number; | ||
nanoseconds: bigint; | ||
@@ -19,5 +19,5 @@ } | ||
convertHrtime(diff); | ||
//=> {seconds: 0.000002399, milliseconds: 0.002399, nanoseconds: 2399} | ||
//=> {seconds: 0.000002399, milliseconds: 0.002399, nanoseconds: 2399n} | ||
``` | ||
*/ | ||
export default function convertHrtime(hrtime: bigint): HighResolutionTime; |
export default function convertHrtime(hrtime) { | ||
const nanoseconds = hrtime; | ||
const milliseconds = nanoseconds / 1000000n; | ||
const seconds = nanoseconds / 1000000000n; | ||
const number = Number(nanoseconds); | ||
const milliseconds = number / 1000000; | ||
const seconds = number / 1000000000; | ||
@@ -6,0 +7,0 @@ return { |
{ | ||
"name": "convert-hrtime", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Convert the result of `process.hrtime.bigint()` to seconds, milliseconds, nanoseconds", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -21,3 +21,3 @@ # convert-hrtime | ||
convertHrtime(diff); | ||
//=> {seconds: 0.000002399, milliseconds: 0.002399, nanoseconds: 2399} | ||
//=> {seconds: 0.000002399, milliseconds: 0.002399, nanoseconds: 2399n} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3335
29