Skip to content

Commit

Permalink
Fix mathematical error when computing System UTC Epoch nanoseconds. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
12wrigja authored Jun 23, 2022
1 parent a01ca8a commit bb59ca9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ecmascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5235,7 +5235,7 @@ export const SystemUTCEpochNanoSeconds: () => JSBI = (() => {
return () => {
const ms = JSBI.BigInt(Date.now());
const result = JSBI.add(JSBI.multiply(ms, MILLION), ns);
ns = JSBI.divide(ms, MILLION);
ns = JSBI.remainder(ms, MILLION);
if (JSBI.greaterThan(result, NS_MAX)) return NS_MAX;
if (JSBI.lessThan(result, NS_MIN)) return NS_MIN;
return result;
Expand Down

0 comments on commit bb59ca9

Please sign in to comment.