Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 11, 2022
1 parent e683147 commit 32f96e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.2.0

## Features

- Migrate to TypeScript

# 1.1.0

## Documentation
Expand Down
20 changes: 10 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ const nowFunc = () => {
return dateNow.bind(undefined, Date.now())
}

const hrtime = (start: bigint) =>
Number(globalThis.process.hrtime.bigint() - start)

const performanceNow = (start: number) =>
Math.round((globalThis.performance.now() - start) * NANOSECS_TO_MILLISECS)

const dateNow = (start: number) => (Date.now() - start) * NANOSECS_TO_MILLISECS

const NANOSECS_TO_MILLISECS = 1e6

/**
* Return the number of nanoseconds since the time origin.
*
Expand All @@ -51,14 +61,4 @@ const nowFunc = () => {
const preciseNow = nowFunc()

export default preciseNow

const hrtime = (start: bigint) =>
Number(globalThis.process.hrtime.bigint() - start)

const performanceNow = (start: number) =>
Math.round((globalThis.performance.now() - start) * NANOSECS_TO_MILLISECS)

const dateNow = (start: number) => (Date.now() - start) * NANOSECS_TO_MILLISECS

const NANOSECS_TO_MILLISECS = 1e6
/* eslint-enable @typescript-eslint/no-unnecessary-condition, n/prefer-global/process */

0 comments on commit 32f96e6

Please sign in to comment.