Skip to content

Commit

Permalink
chore: Loss of precision due to Date now amplification (#46344)
Browse files Browse the repository at this point in the history
Loss of precision due to `Date.now()*1000*1000` (used to record HMR time) has exceeded the safety integer MAX_SAFE_INTEGER.

![image](https://user-images.githubusercontent.com/45198715/221096707-ceaa8fad-1432-428d-8bad-cc83b452127f.png)




## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
  • Loading branch information
harrytothemoon authored Feb 27, 2023
1 parent c0dd8be commit 65ce868
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/next/src/server/dev/hot-reloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ export default class HotReloader {
case 'client-hmr-latency': {
traceChild = {
name: payload.event,
startTime: BigInt(payload.startTime * 1000 * 1000),
endTime: BigInt(payload.endTime * 1000 * 1000),
startTime: BigInt(payload.startTime) * BigInt(1000 * 1000),
endTime: BigInt(payload.endTime) * BigInt(1000 * 1000),
}
break
}
Expand Down

0 comments on commit 65ce868

Please sign in to comment.