switching time format from centieme de seconde to seconds
This commit is contained in:
parent
7984ae43a1
commit
45e7b1d584
|
|
@ -11,7 +11,7 @@ export default function Timer() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!hasCheckedTutorial || !isTimeRuning) return;
|
if (!hasCheckedTutorial || !isTimeRuning) return;
|
||||||
let intervalId;
|
let intervalId;
|
||||||
intervalId = setInterval(() => setGameTime(gameTime + 100), 1000);
|
intervalId = setInterval(() => setGameTime(gameTime + 1), 1000);
|
||||||
// setCurrentTime(currentTime);
|
// setCurrentTime(currentTime);
|
||||||
|
|
||||||
return () => clearInterval(intervalId);
|
return () => clearInterval(intervalId);
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,16 @@ function calculateScore(answers) {
|
||||||
}
|
}
|
||||||
function formatCurrentTime(currentTime) {
|
function formatCurrentTime(currentTime) {
|
||||||
// Minutes calculation
|
// Minutes calculation
|
||||||
const minutes = Math.floor((currentTime % 360000) / 6000)
|
const minutes = Math.floor(currentTime / 60)
|
||||||
.toString()
|
.toString()
|
||||||
.padStart(2, "0");
|
.padStart(2, "0");
|
||||||
|
|
||||||
// Seconds calculation
|
// Seconds calculation
|
||||||
const seconds = Math.floor((currentTime % 6000) / 100)
|
const seconds = Math.floor(currentTime % 60)
|
||||||
.toString()
|
.toString()
|
||||||
.padStart(2, "0");
|
.padStart(2, "0");
|
||||||
|
|
||||||
return `${minutes} : ${seconds}`;
|
return `${minutes} : ${seconds}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { calculateScore, formatCurrentTime };
|
export { calculateScore, formatCurrentTime };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user