summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Timer.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2022-08-07 09:08:20 +0200
committerGitHub <noreply@github.com>2022-08-07 09:08:20 +0200
commitd69f38f415ffd8348f4b8617b2796c5ac554b61a (patch)
tree2909cf66d7b2318fd8475848f12504907cb91b48 /Source/Core/Common/Timer.cpp
parent7b2b559743f09d2b087728d7eb0c14c6b81a9f2a (diff)
parent6e94c20abdbb5284a78afbdca627f1528f78dbc3 (diff)
Merge pull request #10963 from shuffle2/notime
back out using std::chrono for timezone stuff
Diffstat (limited to 'Source/Core/Common/Timer.cpp')
-rw-r--r--Source/Core/Common/Timer.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp
index fb81164390..91381eebd3 100644
--- a/Source/Core/Common/Timer.cpp
+++ b/Source/Core/Common/Timer.cpp
@@ -7,6 +7,7 @@
#ifdef _WIN32
#include <Windows.h>
+#include <ctime>
#include <timeapi.h>
#else
#include <sys/time.h>
@@ -67,12 +68,10 @@ u64 Timer::ElapsedMs() const
u64 Timer::GetLocalTimeSinceJan1970()
{
-#ifdef _MSC_VER
- std::chrono::zoned_seconds seconds(
- std::chrono::current_zone(),
- std::chrono::time_point_cast<std::chrono::seconds>(std::chrono::system_clock::now()));
- return seconds.get_local_time().time_since_epoch().count();
-#else
+ // TODO Would really, really like to use std::chrono here, but Windows did not support
+ // std::chrono::current_zone() until 19H1, and other compilers don't even provide support for
+ // timezone-related parts of chrono. Someday!
+ // see https://bugs.dolphin-emu.org/issues/13007#note-4
time_t sysTime, tzDiff, tzDST;
time(&sysTime);
tm* gmTime = localtime(&sysTime);
@@ -88,7 +87,6 @@ u64 Timer::GetLocalTimeSinceJan1970()
tzDiff = sysTime - mktime(gmTime);
return static_cast<u64>(sysTime + tzDiff + tzDST);
-#endif
}
void Timer::IncreaseResolution()