Merge pull request #504 from darkiox/master

Fix Discord RPC Timestamp jitter
This commit is contained in:
Rick van Lieshout 2024-12-09 11:21:27 +01:00 committed by GitHub
commit aaf7a1b662
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,8 +103,7 @@ const getActivity = (): SetActivity => {
if (includeTimestamps) { if (includeTimestamps) {
const currentSeconds = convertDurationToSeconds(mediaInfo.current); const currentSeconds = convertDurationToSeconds(mediaInfo.current);
const durationSeconds = convertDurationToSeconds(mediaInfo.duration); const durationSeconds = convertDurationToSeconds(mediaInfo.duration);
const date = new Date(); const now = Math.trunc((Date.now() + 500) / 1000);
const now = Math.floor(date.getTime() / 1000);
presence.startTimestamp = now - currentSeconds; presence.startTimestamp = now - currentSeconds;
presence.endTimestamp = presence.startTimestamp + durationSeconds; presence.endTimestamp = presence.startTimestamp + durationSeconds;
} }