From a3aa45a96b432a54996ff8c48706b3e812b6e6b0 Mon Sep 17 00:00:00 2001 From: Darkiox Date: Mon, 25 Nov 2024 19:15:26 -0300 Subject: [PATCH] fix: discord rpc timestamp jitter --- src/scripts/discord.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scripts/discord.ts b/src/scripts/discord.ts index 9da1387..21d03b5 100644 --- a/src/scripts/discord.ts +++ b/src/scripts/discord.ts @@ -103,8 +103,7 @@ const getActivity = (): SetActivity => { if (includeTimestamps) { const currentSeconds = convertDurationToSeconds(mediaInfo.current); const durationSeconds = convertDurationToSeconds(mediaInfo.duration); - const date = new Date(); - const now = Math.floor(date.getTime() / 1000); + const now = Math.trunc((Date.now() + 500) / 1000); presence.startTimestamp = now - currentSeconds; presence.endTimestamp = presence.startTimestamp + durationSeconds; }