diff options
| author | Dentomologist <dentomologist@gmail.com> | 2022-08-05 17:31:25 -0700 |
|---|---|---|
| committer | Dentomologist <dentomologist@gmail.com> | 2022-08-06 13:28:28 -0700 |
| commit | 02cd4ecf7d8a3e9738acffd1c38c99ea5599d7ad (patch) | |
| tree | dc20c1ed0ac727376e6a4c07cd5decd908f450a1 | |
| parent | ff26f6435e9fbbfdaf9828e59521cd4c820ac0d6 (diff) | |
Core: Use std::chrono time_since_epoch
| -rw-r--r-- | Source/Core/Core/State.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index d4abf52bcd..a6467f2b2c 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -276,14 +276,7 @@ static constexpr int DOUBLE_TIME_OFFSET = (38 * 365 * 24 * 60 * 60); static double GetSystemTimeAsDouble() { - // FYI: std::chrono::system_clock epoch is not required to be 1970 until c++20. - // We will however assume time_t IS unix time. - using Clock = std::chrono::system_clock; - - // TODO: Use this on switch to c++20: - // const auto since_epoch = Clock::now().time_since_epoch(); - const auto unix_epoch = Clock::from_time_t({}); - const auto since_epoch = Clock::now() - unix_epoch; + const auto since_epoch = std::chrono::system_clock::now().time_since_epoch(); const auto since_double_time_epoch = since_epoch - std::chrono::seconds(DOUBLE_TIME_OFFSET); return std::chrono::duration_cast<std::chrono::duration<double>>(since_double_time_epoch).count(); |
