+// Defining _POSIX_C_SOURCE macro with 199309L (or greater) as value
+// causes header files to expose definitions
+// corresponding to the POSIX.1b, Real-time extensions
+// (IEEE Std 1003.1b-1993) specification
+//
+// For this specific file, see use of clock_gettime,
+// Refer to http://pubs.opengroup.org/stage7tc1/functions/clock_gettime.html
+// and to http://man7.org/linux/man-pages/man2/clock_gettime.2.html
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 200809L
+#endif
+
+// Platform check can be extended to check and/or define more, or could be
+// moved into a config.h
+#if !defined(__ARDUINO__) && !defined(ARDUINO)
+#define HAVE_UNISTD_H 1
+#endif
+
+// Pull in _POSIX_TIMERS feature test macro to check for
+// clock_gettime() support.
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+
+// if we have unistd.h, we're a Unix system
+#include <time.h>
+#include <sys/time.h>
+#endif