diff --git a/Modules/private/Timing.cpp b/Modules/private/Timing.cpp index 0a71c764..79472485 100644 --- a/Modules/private/Timing.cpp +++ b/Modules/private/Timing.cpp @@ -7,6 +7,8 @@ #define GETTIMEMSC() (time_ms)(std::chrono::duration_cast(std::chrono::time_point_cast(std::chrono::high_resolution_clock::now()).time_since_epoch()).count()) +#define GETTIMENSC() (time_ns)(std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count()) + #define THREAD_SLEEP(time_ms) std::this_thread::sleep_for(std::chrono::milliseconds(time_ms)) tp::time_ms tp::gCurrentTime = tp::get_time(); @@ -17,6 +19,8 @@ namespace tp { return gCurrentTime; } + time_ns get_time_ns() { return GETTIMENSC(); } + void updateGlobalTime() { get_time(); } diff --git a/Modules/public/Environment.hpp b/Modules/public/Environment.hpp index 43bc75a2..032b5d68 100644 --- a/Modules/public/Environment.hpp +++ b/Modules/public/Environment.hpp @@ -91,7 +91,7 @@ namespace tp { #define ENV_OS_LINUX enum class OS { UNDEF, LINUX, WINDOWS, ANDROID, IOS } mOS = OS::LINUX; #elif defined(__ANDROID__) - enum class OS { UNDEF, LINUX, WINDOWS, ANDROID, IOS } mOS = OS::ANDOID; + enum class OS { UNDEF, LINUX, WINDOWS, ANDROID, IOS } mOS = OS::ANDROID; #define ENV_OS_ANDROID #else #error "unexplored compilation to target os" diff --git a/Modules/public/Timing.hpp b/Modules/public/Timing.hpp index 505738b6..e8858b76 100644 --- a/Modules/public/Timing.hpp +++ b/Modules/public/Timing.hpp @@ -35,6 +35,7 @@ namespace tp { void sleep(time_ms duration); time_ms get_time(); + time_ns get_time_ns(); void updateGlobalTime(); struct FpsCounter {