summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Timer.cpp
diff options
context:
space:
mode:
authorAnthony <Helios747@users.noreply.github.com>2019-06-14 12:22:16 -0700
committerGitHub <noreply@github.com>2019-06-14 12:22:16 -0700
commit9cf6ba13dfa04e2ef402eef19cd67435e6849d29 (patch)
treeb87080969dd47a01c3a7845d65ef2afdef90928d /Source/Core/Common/Timer.cpp
parent59155b4d5ef891597294b22c1dab581d47c3ea0d (diff)
parent5b92d5076a0be89945fa0fc722749dd5fbfcdf4c (diff)
Merge pull request #8177 from lioncash/fmt
Common: Use fmt where applicable
Diffstat (limited to 'Source/Core/Common/Timer.cpp')
-rw-r--r--Source/Core/Common/Timer.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp
index 1d25cc0f71..794f2dfd49 100644
--- a/Source/Core/Common/Timer.cpp
+++ b/Source/Core/Common/Timer.cpp
@@ -2,7 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include <cinttypes>
+#include "Common/Timer.h"
+
#include <ctime>
#include <string>
@@ -16,9 +17,10 @@
#include <sys/time.h>
#endif
+#include <fmt/format.h>
+
#include "Common/CommonTypes.h"
#include "Common/StringUtil.h"
-#include "Common/Timer.h"
namespace Common
{
@@ -149,9 +151,8 @@ std::string Timer::GetTimeElapsedFormatted() const
// Hours
u32 Hours = Minutes / 60;
- std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03" PRIu64, Hours, Minutes % 60,
- Seconds % 60, Milliseconds % 1000);
- return TmpStr;
+ return fmt::format("{:02}:{:02}:{:02}:{:03}", Hours, Minutes % 60, Seconds % 60,
+ Milliseconds % 1000);
}
// Get current time
@@ -217,15 +218,15 @@ std::string Timer::GetTimeFormatted()
#ifdef _WIN32
struct timeb tp;
(void)::ftime(&tp);
- return UTF16ToUTF8(tmp) + StringFromFormat(":%03i", tp.millitm);
+ return UTF16ToUTF8(tmp) + fmt::format(":{:03}", tp.millitm);
#elif defined __APPLE__
struct timeval t;
(void)gettimeofday(&t, nullptr);
- return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
+ return fmt::format("{}:{:03}", tmp, t.tv_usec / 1000);
#else
struct timespec t;
(void)clock_gettime(CLOCK_MONOTONIC, &t);
- return StringFromFormat("%s:%03d", tmp, (int)(t.tv_nsec / 1000000));
+ return fmt::format("{}:{:03}", tmp, t.tv_nsec / 1000000);
#endif
}