@foxglove/rostime
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -234,3 +234,3 @@ "use strict"; | ||
function toNanoSec({ sec, nsec }) { | ||
return BigInt(sec) * BigInt(1e9) + BigInt(nsec); | ||
return BigInt(sec) * 1000000000n + BigInt(nsec); | ||
} | ||
@@ -278,3 +278,5 @@ exports.toNanoSec = toNanoSec; | ||
// and https://github.com/ros/roscpp_core/blob/7583b7d38c6e1c2e8623f6d98559c483f7a64c83/rostime/src/time.cpp#L536 | ||
return { sec: Math.trunc(Number(nsec / BigInt(1e9))), nsec: Number(nsec % BigInt(1e9)) }; | ||
// | ||
// Note: BigInt(1e9) is slower than writing out the number | ||
return { sec: Number(nsec / 1000000000n), nsec: Number(nsec % 1000000000n) }; | ||
} | ||
@@ -281,0 +283,0 @@ exports.fromNanoSec = fromNanoSec; |
{ | ||
"name": "@foxglove/rostime", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "ROS (Robot Operating System) Time and Duration primitives and helper methods", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,2 +5,4 @@ # @foxglove/rostime | ||
[![npm version](https://img.shields.io/npm/v/@foxglove/rostime.svg?style=flat)](https://www.npmjs.com/package/@foxglove/rostime) | ||
## Introduction | ||
@@ -7,0 +9,0 @@ |
@@ -252,3 +252,3 @@ // This Source Code Form is subject to the terms of the Mozilla Public | ||
export function toNanoSec({ sec, nsec }: Time): bigint { | ||
return BigInt(sec) * BigInt(1e9) + BigInt(nsec); | ||
return BigInt(sec) * 1_000_000_000n + BigInt(nsec); | ||
} | ||
@@ -296,3 +296,5 @@ | ||
// and https://github.com/ros/roscpp_core/blob/7583b7d38c6e1c2e8623f6d98559c483f7a64c83/rostime/src/time.cpp#L536 | ||
return { sec: Math.trunc(Number(nsec / BigInt(1e9))), nsec: Number(nsec % BigInt(1e9)) }; | ||
// | ||
// Note: BigInt(1e9) is slower than writing out the number | ||
return { sec: Number(nsec / 1_000_000_000n), nsec: Number(nsec % 1_000_000_000n) }; | ||
} | ||
@@ -299,0 +301,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
134993
1937
34
0