From 45e7b1d584484d99d2b7d952517f3aebd43d9b1a Mon Sep 17 00:00:00 2001 From: Antoine M Date: Mon, 15 Jul 2024 16:02:18 +0200 Subject: [PATCH] switching time format from centieme de seconde to seconds --- src/components/game/Timer.jsx | 2 +- src/utils/gameFunctions.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/game/Timer.jsx b/src/components/game/Timer.jsx index 3cf43fb..363729e 100644 --- a/src/components/game/Timer.jsx +++ b/src/components/game/Timer.jsx @@ -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); diff --git a/src/utils/gameFunctions.js b/src/utils/gameFunctions.js index 4871bd2..61ae72b 100644 --- a/src/utils/gameFunctions.js +++ b/src/utils/gameFunctions.js @@ -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 }; \ No newline at end of file +export { calculateScore, formatCurrentTime };