Skip to content

Commit f74bcb3

Browse files
fix: convert ms timestamps with BigInt before ns scale (closes #3292)
1 parent aed0848 commit f74bcb3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/webapp/app/v3/eventRepository/common.server.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function extractContextFromCarrier(carrier: Record<string, unknown>) {
2626
}
2727

2828
export function getNowInNanoseconds(): bigint {
29-
return BigInt(new Date().getTime() * 1_000_000);
29+
return BigInt(new Date().getTime()) * BigInt(1_000_000);
3030
}
3131

3232
export function getDateFromNanoseconds(nanoseconds: bigint): Date {
@@ -40,7 +40,7 @@ export function calculateDurationFromStart(
4040
) {
4141
const $endtime = typeof endTime === "string" ? new Date(endTime) : endTime;
4242

43-
const duration = Number(BigInt($endtime.getTime() * 1_000_000) - startTime);
43+
const duration = Number(BigInt($endtime.getTime()) * BigInt(1_000_000) - startTime);
4444

4545
if (minimumDuration && duration < minimumDuration) {
4646
return minimumDuration;

‎apps/webapp/app/v3/runEngineHandlers.server.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ export function registerRunEngineEventBusHandlers() {
559559
);
560560

561561
await eventRepository.recordEvent(retryMessage, {
562-
startTime: BigInt(time.getTime() * 1000000),
562+
startTime: BigInt(time.getTime()) * BigInt(1_000_000),
563563
taskSlug: run.taskIdentifier,
564564
environment,
565565
attributes: {

0 commit comments

Comments
 (0)