Skip to content

Commit

Permalink
refactor(bench): update timeDiff()
Browse files Browse the repository at this point in the history
- default 2nd arg to current timestamp
  • Loading branch information
postspectacular committed Feb 11, 2023
1 parent 5d28c39 commit 37054e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/bench/src/now.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export const now: Fn0<Timestamp> =
: () => Date.now() * 1e6;

/**
* Returns the difference in milliseconds between 2 given
* {@link Timestamp}s.
* Returns the difference in milliseconds between 2 given {@link Timestamp}s.
* `b` defaults to result of {@link now}.
*
* @param a
* @param b
*/
export const timeDiff: FnU2<Timestamp, number> = (a, b) =>
export const timeDiff: FnU2<Timestamp, number> = (a, b = now()) =>
(typeof BigInt !== "undefined"
? Number(<bigint>b - <bigint>a)
: <number>b - <number>a) * 1e-6;

0 comments on commit 37054e0

Please sign in to comment.