]> sigrok.org Git - libserialport.git/blobdiff - libserialport_internal.h
Support timing helpers on Windows.
[libserialport.git] / libserialport_internal.h
index d784472bb12d0c218413d645ff38e3dec8588da3..77c31a5cc2b94a78ba64398f08dbed5158bfd65e 100644 (file)
@@ -26,6 +26,8 @@
 /* For timeradd, timersub, timercmp, realpath. */
 #define _BSD_SOURCE 1 /* for glibc < 2.19 */
 #define _DEFAULT_SOURCE 1 /* for glibc >= 2.20 */
+/* For clock_gettime and associated types. */
+#define _POSIX_C_SOURCE 199309L
 #endif
 
 #include <string.h>
@@ -37,6 +39,8 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
 #ifdef _WIN32
 #include <windows.h>
 #include <tchar.h>
@@ -66,8 +70,9 @@
 #endif
 #ifdef __linux__
 #include <dirent.h>
-#ifndef __ANDROID__
-#include "linux/serial.h"
+/* Android only has linux/serial.h from platform 21 onwards. */
+#if !(defined(__ANDROID__) && (__ANDROID_API__ < 21))
+#include <linux/serial.h>
 #endif
 #include "linux_termios.h"