diff --git a/echrono/Clock.cpp b/echrono/Clock.cpp index 9edb53a..019ce6c 100644 --- a/echrono/Clock.cpp +++ b/echrono/Clock.cpp @@ -1,4 +1,4 @@ -/** @file +o/** @file * @author Edouard DUPIN * @copyright 2016, Edouard DUPIN, all right reserved * @license MPL v2.0 (see license file) diff --git a/echrono/Steady.cpp b/echrono/Steady.cpp index 34ceaa0..9ac60cd 100644 --- a/echrono/Steady.cpp +++ b/echrono/Steady.cpp @@ -18,7 +18,9 @@ static int64_t getTime() { return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_usec); #elif defined(__TARGET_OS__Web) \ || defined(__TARGET_OS__Linux) \ - || defined(__TARGET_OS__buildroot) + || defined(__TARGET_OS__buildroot) \ + || defined(__TARGET_OS__MacOs) \ + || defined(__TARGET_OS__IOs) struct timespec now; #ifdef CLOCK_BOOTTIME int ret = clock_gettime(CLOCK_BOOTTIME, &now); @@ -31,17 +33,6 @@ static int64_t getTime() { now.tv_nsec = 0; } return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_nsec)/1000LL; - #elif defined(__TARGET_OS__MacOs) \ - || defined(__TARGET_OS__IOs) - struct timespec now; - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - now.tv_sec = mts.tv_sec; - now.tv_nsec = mts.tv_nsec; - return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_nsec)/1000LL; #else #error must be implemented ... #endif diff --git a/echrono/Time.cpp b/echrono/Time.cpp index a7cdcb9..cf2ac8f 100644 --- a/echrono/Time.cpp +++ b/echrono/Time.cpp @@ -18,7 +18,9 @@ static int64_t getTime() { return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_usec); #elif defined(__TARGET_OS__Web) \ || defined(__TARGET_OS__Linux) \ - || defined(__TARGET_OS__buildroot) + || defined(__TARGET_OS__buildroot) \ + || defined(__TARGET_OS__MacOs) \ + || defined(__TARGET_OS__IOs) struct timespec now; int ret = clock_gettime(CLOCK_REALTIME, &now); if (ret != 0) { @@ -27,17 +29,6 @@ static int64_t getTime() { now.tv_nsec = 0; } return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_nsec)/1000LL; - #elif defined(__TARGET_OS__MacOs) \ - || defined(__TARGET_OS__IOs) - struct timespec now; - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - now.tv_sec = mts.tv_sec; - now.tv_nsec = mts.tv_nsec; - return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_nsec)/1000LL; #else #error must be implemented ... #endif