switching time format from centieme de seconde to seconds

This commit is contained in:
Antoine M 2024-07-15 16:02:18 +02:00
parent 7984ae43a1
commit 45e7b1d584
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ export default function Timer() {
useEffect(() => {
if (!hasCheckedTutorial || !isTimeRuning) return;
let intervalId;
intervalId = setInterval(() => setGameTime(gameTime + 100), 1000);
intervalId = setInterval(() => setGameTime(gameTime + 1), 1000);
// setCurrentTime(currentTime);
return () => clearInterval(intervalId);

View File

@ -5,16 +5,16 @@ function calculateScore(answers) {
}
function formatCurrentTime(currentTime) {
// Minutes calculation
const minutes = Math.floor((currentTime % 360000) / 6000)
const minutes = Math.floor(currentTime / 60)
.toString()
.padStart(2, "0");
// Seconds calculation
const seconds = Math.floor((currentTime % 6000) / 100)
const seconds = Math.floor(currentTime % 60)
.toString()
.padStart(2, "0");
return `${minutes} : ${seconds}`;
}
export { calculateScore, formatCurrentTime };
export { calculateScore, formatCurrentTime };