diff --git a/src/common/timer.cpp b/src/common/timer.cpp index 5972abece..93ccc629c 100644 --- a/src/common/timer.cpp +++ b/src/common/timer.cpp @@ -38,16 +38,7 @@ bool Timer::IsPaused() const { // return time in milliseconds double Timer::GetTimeMs() const { - if (m_is_paused) { - return 1000.0 * (static_cast(m_PauseTime - m_StartTime)) / - static_cast(m_Frequency); - } - - uint64_t current_time = 0; - SysQueryPerformanceCounter(¤t_time); - - return 1000.0 * (static_cast(current_time - m_StartTime)) / - static_cast(m_Frequency); + return GetTimeS() * 1000.0; } // return time in seconds diff --git a/src/libs/libs.h b/src/libs/libs.h index 2991d26e3..1ec3285aa 100644 --- a/src/libs/libs.h +++ b/src/libs/libs.h @@ -7,6 +7,8 @@ #include "common/threads.h" #include "loader/timer.h" // IWYU pragma: keep +#include + // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define PRINT_NAME_ENABLED g_print_name @@ -50,7 +52,10 @@ #define PRINT_NAME() \ if (PRINT_NAME_ENABLED) { \ if (Log::GetDirection() != Log::Direction::Silent) { \ - const auto print_name_time = Loader::Timer::GetTime().ToString("HH24:MI:SS.FFF"); \ + const auto elapsed_ms = static_cast(Loader::Timer::GetTimeMs()); \ + const auto print_name_time = fmt::format( \ + "{:02}:{:02}:{:02}.{:03}", elapsed_ms / 3600000, (elapsed_ms / 60000) % 60, \ + (elapsed_ms / 1000) % 60, elapsed_ms % 1000); \ LOGF_COLOR(Log::Color::Cyan, "[%d][%s] %s::%s::%s()\n", \ Common::Thread::GetThreadIdUnique(), print_name_time.c_str(), g_library, \ g_module, __func__); \ diff --git a/src/loader/timer.cpp b/src/loader/timer.cpp index 00539ea7a..c41086c97 100644 --- a/src/loader/timer.cpp +++ b/src/loader/timer.cpp @@ -1,7 +1,5 @@ #include "common/timer.h" -#include "common/abi.h" -#include "common/dateTime.h" #include "loader/timer.h" namespace Loader::Timer { @@ -16,8 +14,4 @@ double GetTimeMs() { return g_timer.GetTimeMs(); } -Common::Time GetTime() { - return Common::Time(static_cast(GetTimeMs())); -} - } // namespace Loader::Timer diff --git a/src/loader/timer.h b/src/loader/timer.h index 30bb82186..c31faad95 100644 --- a/src/loader/timer.h +++ b/src/loader/timer.h @@ -1,14 +1,10 @@ #ifndef EMULATOR_INCLUDE_EMULATOR_LOADER_TIMER_H_ #define EMULATOR_INCLUDE_EMULATOR_LOADER_TIMER_H_ -#include "common/abi.h" -#include "common/common.h" -#include "common/dateTime.h" namespace Loader::Timer { -void Start(); -double GetTimeMs(); -Common::Time GetTime(); +void Start(); +double GetTimeMs(); struct Lifecycle { static constexpr const char* name = "Timer"; diff --git a/tests/SaveDataMemoryTests.cpp b/tests/SaveDataMemoryTests.cpp index aeaf67171..87d14fb3f 100644 --- a/tests/SaveDataMemoryTests.cpp +++ b/tests/SaveDataMemoryTests.cpp @@ -27,8 +27,8 @@ bool SystemContentParamSfoGetString(const char*, std::string* value) { } void SymbolDatabase::Add(const SymbolResolve&, uint64_t, const std::string&) {} namespace Timer { -Common::Time GetTime() { - return Common::Time(0); +double GetTimeMs() { + return 0.0; } } // namespace Timer } // namespace Loader