Skip to content

Commit

Permalink
Fix durations (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdasda7777 authored Jan 1, 2025
1 parent e7aa0ff commit 9e8adad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rpc/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,10 @@ module.exports = async (status) => {
output.largeImageText = (output.largeImageText + " ").substring(0, 128);
output.smallImageText = (output.smallImageText + " ").substring(0, 128);

const end = Math.floor(Date.now() / 1000 + ((status.length - status.time) / status.rate));
if (status.state === 'playing' && config.rpc.displayTimeRemaining && status.length != 0) {
output.endTimestamp = end;
const now = new Date().valueOf();
output.startTimestamp = Math.round(now - status.time * 1000);
output.endTimestamp = Math.round(now + (status.length - status.time) * 1000);
}
log('Format output', output);
return output;
Expand Down

0 comments on commit 9e8adad

Please sign in to comment.