diff options
Diffstat (limited to 'src/common/timer.cpp')
| -rw-r--r-- | src/common/timer.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/timer.cpp b/src/common/timer.cpp index c9803109e..f0c5b1a43 100644 --- a/src/common/timer.cpp +++ b/src/common/timer.cpp | |||
| @@ -2,7 +2,10 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <time.h> | 5 | #include <ctime> |
| 6 | |||
| 7 | #include <fmt/format.h> | ||
| 8 | |||
| 6 | #ifdef _WIN32 | 9 | #ifdef _WIN32 |
| 7 | #include <windows.h> | 10 | #include <windows.h> |
| 8 | // windows.h needs to be included before other windows headers | 11 | // windows.h needs to be included before other windows headers |
| @@ -104,8 +107,8 @@ std::string Timer::GetTimeElapsedFormatted() const { | |||
| 104 | // Hours | 107 | // Hours |
| 105 | u32 Hours = Minutes / 60; | 108 | u32 Hours = Minutes / 60; |
| 106 | 109 | ||
| 107 | std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03i", Hours, Minutes % 60, Seconds % 60, | 110 | std::string TmpStr = fmt::format("{:02}:{:02}:{:02}:{:03}", Hours, Minutes % 60, Seconds % 60, |
| 108 | Milliseconds % 1000); | 111 | Milliseconds % 1000); |
| 109 | return TmpStr; | 112 | return TmpStr; |
| 110 | } | 113 | } |
| 111 | 114 | ||
| @@ -165,11 +168,11 @@ std::string Timer::GetTimeFormatted() { | |||
| 165 | #ifdef _WIN32 | 168 | #ifdef _WIN32 |
| 166 | struct timeb tp; | 169 | struct timeb tp; |
| 167 | (void)::ftime(&tp); | 170 | (void)::ftime(&tp); |
| 168 | return StringFromFormat("%s:%03i", tmp, tp.millitm); | 171 | return fmt::format("{}:{:03}", tmp, tp.millitm); |
| 169 | #else | 172 | #else |
| 170 | struct timeval t; | 173 | struct timeval t; |
| 171 | (void)gettimeofday(&t, nullptr); | 174 | (void)gettimeofday(&t, nullptr); |
| 172 | return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000)); | 175 | return fmt::format("{}:{:03}", tmp, static_cast<int>(t.tv_usec / 1000)); |
| 173 | #endif | 176 | #endif |
| 174 | } | 177 | } |
| 175 | 178 | ||