mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-13 18:39:10 +01:00
Linux/MacOS: Use faster clock_gettime() for tick_cached() (#563)
This commit is contained in:
parent
fca7f5dfe4
commit
5a143c7b4b
@ -69,6 +69,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <time.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@ -362,8 +363,10 @@ bool match_any_of(T1 value, T2 compareTo, Types&&... others)
|
|||||||
const long long _Part = (_Ctr % _Freq) * std::nano::den / _Freq;
|
const long long _Part = (_Ctr % _Freq) * std::nano::den / _Freq;
|
||||||
return (std::chrono::steady_clock::time_point(std::chrono::nanoseconds(_Whole + _Part)));
|
return (std::chrono::steady_clock::time_point(std::chrono::nanoseconds(_Whole + _Part)));
|
||||||
#else
|
#else
|
||||||
// todo: Add faster implementation for linux
|
struct timespec tp;
|
||||||
return std::chrono::steady_clock::now();
|
clock_gettime(CLOCK_MONOTONIC_RAW, &tp);
|
||||||
|
return std::chrono::steady_clock::time_point(
|
||||||
|
std::chrono::seconds(tp.tv_sec) + std::chrono::nanoseconds(tp.tv_nsec));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user