Skip to content

Commit

Permalink
Fix arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Mar 1, 2023
1 parent d1fe917 commit ae5fbfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/perf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ export class PerfService implements Startable {
async measureDownloadBandwidth (peer: PeerId, size: bigint) {
const now = Date.now()
await this.startPerfOnStream(peer, 0n, size)
return (8n * size) / BigInt((Date.now() - now) / 1000)
return (8000n * size) / BigInt(Date.now() - now)
}

// measureUploadBandwidth returns the measured bandwidth in bit per second
async measureUploadBandwidth (peer: PeerId, size: bigint) {
const now = Date.now()
await this.startPerfOnStream(peer, size, 0n)
return (8n * size) / BigInt((Date.now() - now) / 1000)
return (8000n * size) / BigInt(Date.now() - now)
}
}

0 comments on commit ae5fbfd

Please sign in to comment.