chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:32:57 +08:00
commit cd420f9332
4811 changed files with 884702 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* Contains two parts: the first part is the seconds, the second part is the nanoseconds.
*
*/
export type ClockTime = [number, number];
export interface Clock {
preciseNow(): ClockTime;
reset(): void;
}
export function calculateDurationInMs(start: ClockTime, end: ClockTime): number {
const [startSeconds, startNanoseconds] = start;
const [endSeconds, endNanoseconds] = end;
const seconds = endSeconds - startSeconds;
const nanoseconds = endNanoseconds - startNanoseconds;
return Math.floor(seconds * 1000 + nanoseconds / 1000000);
}