Skip to content

Commit ec130c0

Browse files
committed
simplified algorithm
1 parent ddb4e01 commit ec130c0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/webrtc/src/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ export function reverseDirection(dir: MediaDirection): MediaDirection {
5050

5151
export const milliTime = Date.now;
5252

53-
const loadTimeNs = process.hrtime.bigint();
54-
const loadTimeMs = BigInt(Date.now()) * 1000n;
53+
const startupTimestampInMicroseconds = BigInt(Date.now()) * 1000n - process.hrtime.bigint() / 1000n;
5554

5655
export const microTime = () => {
57-
return (loadTimeMs + (process.hrtime.bigint() - loadTimeNs) / 1000n);
56+
return (startupTimestampInMicroseconds + process.hrtime.bigint()/1000n);
5857
};
5958

6059
export const timestampSeconds = () => Date.now() / 1000;

0 commit comments

Comments
 (0)