mirror of
https://github.com/SFML/SFML.git
synced 2025-02-23 14:56:02 +08:00
Simplify how CLOCK_BOOTTIME
is checked on Android
This commit is contained in:
parent
c11391ae31
commit
80d277cca3
@ -29,17 +29,17 @@
|
|||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
#ifndef CLOCK_BOOTTIME
|
||||||
|
#error "CLOCK_BOOTTIME is essential for SuspendAwareClock to work"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
|
|
||||||
SuspendAwareClock::time_point SuspendAwareClock::now() noexcept
|
SuspendAwareClock::time_point SuspendAwareClock::now() noexcept
|
||||||
{
|
{
|
||||||
::timespec ts{};
|
::timespec ts{};
|
||||||
#ifdef CLOCK_BOOTTIME
|
|
||||||
clock_gettime(CLOCK_BOOTTIME, &ts);
|
clock_gettime(CLOCK_BOOTTIME, &ts);
|
||||||
#else
|
|
||||||
#error "CLOCK_BOOTTIME is essential for SuspendAwareClock to work"
|
|
||||||
#endif // CLOCK_BOOTTIME
|
|
||||||
return time_point(std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec));
|
return time_point(std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user