Skip to content

Commit

Permalink
FIX: Removed playtime days
Browse files Browse the repository at this point in the history
  • Loading branch information
afska committed Sep 24, 2024
1 parent fc8da00 commit 1b48474
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/scenes/StatsScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,20 @@ std::string StatsScene::getPlayTime() {
u32 playTimeSeconds = SAVEFILE_read32(SRAM->stats.playTimeSeconds);
std::string playTime = "";

u32 days, hours, minutes, seconds;
days = Div(playTimeSeconds, 86400);
playTimeSeconds = DivMod(playTimeSeconds, 86400);
u32 hours, minutes, seconds;
hours = Div(playTimeSeconds, 3600);
playTimeSeconds = DivMod(playTimeSeconds, 3600);
minutes = Div(playTimeSeconds, 60);
seconds = DivMod(playTimeSeconds, 60);
if (days > 0)
playTime += std::to_string(days) + "d ";
if (hours > 0 || days > 0)
if (hours > 0)
playTime += std::to_string(hours) + "h ";
if (minutes > 0 || hours > 0 || days > 0)
if (minutes > 0 || hours > 0)
playTime += std::to_string(minutes) + "m ";
playTime += std::to_string(seconds) + "s";

if (playTime.size() > 14)
return "!!!";

return playTime;
}

Expand Down

0 comments on commit 1b48474

Please sign in to comment.