Fix: Wrong time used for calculation

This commit is contained in:
Dorian Zedler 2022-05-12 17:34:33 +02:00
parent 6cd1b574c2
commit 09d72ce3a7
Signed by: dorian
GPG key ID: 989DE36109AFA354

View file

@ -29,7 +29,7 @@ document.addEventListener('alpine:init' , () => {
setInterval(() => { setInterval(() => {
if(!this.currentData) return; if(!this.currentData) return;
const passedSeconds = parseInt(((Date.now()-this.timeOffsetToServer) / 1000) - this.currentData.startedAt); const passedSeconds = parseInt(((performance.now()-this.timeOffsetToServer) / 1000) - this.currentData.startedAt);
let remaningSeconds; let remaningSeconds;
if(this.currentData.repeatEnabled) { if(this.currentData.repeatEnabled) {
remaningSeconds = parseInt(this.currentData.time * 60 - (passedSeconds % (this.currentData.time * 60))); remaningSeconds = parseInt(this.currentData.time * 60 - (passedSeconds % (this.currentData.time * 60)));