From 73713737c61320c79a6921a0066a0b3f2756d721 Mon Sep 17 00:00:00 2001 From: lizzie Date: Fri, 21 Nov 2025 19:28:26 +0100 Subject: [PATCH] [frontend] use hh:mm:ss for playtime so we don't have to translate h,m or s suffixes (#3065) Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3065 Reviewed-by: Caio Oliveira Reviewed-by: MaranBr Co-authored-by: lizzie Co-committed-by: lizzie --- src/frontend_common/play_time_manager.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/frontend_common/play_time_manager.cpp b/src/frontend_common/play_time_manager.cpp index 782433392f..4b0ba420ed 100644 --- a/src/frontend_common/play_time_manager.cpp +++ b/src/frontend_common/play_time_manager.cpp @@ -167,25 +167,9 @@ void PlayTimeManager::ResetProgramPlayTime(u64 program_id) { Save(); } -std::string PlayTimeManager::GetReadablePlayTime(u64 time_seconds) { - if (time_seconds == 0) { - return {}; - } - - const auto time_minutes = std::max(static_cast(time_seconds) / 60.0, 1.0); - const auto time_hours = static_cast(time_seconds) / 3600.0; - const bool is_minutes = time_minutes < 60.0; - - if (is_minutes) { - return fmt::format("{:.0f} m", time_minutes); - } else { - const bool has_remainder = time_seconds % 60 != 0; - if (has_remainder) { - return fmt::format("{:.1f} h", time_hours); - } else { - return fmt::format("{:.0f} h", time_hours); - } - } +std::string PlayTimeManager::GetReadablePlayTime(u64 t) { + return t > 0 ? fmt::format("{:02}:{:02}:{:02}", t / 3600, (t / 60) % 60, t % 60) + : std::string{}; } std::string PlayTimeManager::GetPlayTimeHours(u64 time_seconds) {