Modules: nanosecond wall clock and the Android enumerator name #2

Merged
ilusha merged 2 commits from Modules into master 2026-10-27 01:53:04 +03:00
3 changed files with 6 additions and 1 deletions

View file

@ -7,6 +7,8 @@
#define GETTIMEMSC() (time_ms)(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch()).count())
#define GETTIMENSC() (time_ns)(std::chrono::duration_cast<std::chrono::nanoseconds>(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();
}

View file

@ -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"

View file

@ -35,6 +35,7 @@ namespace tp {
void sleep(time_ms duration);
time_ms get_time();
time_ns get_time_ns();
void updateGlobalTime();
struct FpsCounter {