+#ifdef __APPLE__
+ #include <TargetConditionals.h>
+ #if defined(TARGET_OS_IPHONE) && __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
+ // Preserve compatibility with pre-iOS 10 devices where there is no clock_get_time.
+ #undef CLOCK_REALTIME
+ #endif
+#endif
+
+#if (defined(__MACH__) || defined(TARGET_OS_IPHONE)) && !defined(CLOCK_REALTIME)