Skip to content

Commit

Permalink
Merge pull request #504 from darkiox/master
Browse files Browse the repository at this point in the history
Fix Discord RPC Timestamp jitter
  • Loading branch information
Mastermindzh authored Dec 9, 2024
2 parents 755be0e + a3aa45a commit aaf7a1b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/scripts/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit aaf7a1b

Please sign in to comment.