OSDN Git Service

Implement a subset of the POSIX.1b-1993 clock API.
[mingw/mingw-org-wsl.git] / mingwrt / include / time.h
index 634c831..d27add7 100644 (file)
@@ -423,6 +423,34 @@ int nanosleep( const struct timespec *period, struct timespec *residual )
     ? (unsigned)(-1) : (unsigned)(period->tv_nsec));
 }
 #endif /* !__NO_INLINE__ */
+
+#if _POSIX_C_SOURCE >= 199309L
+/* POSIX.1b-1993 introduced the optional POSIX clocks API; it
+ * was subsequently moved to "base", as of POSIX.1-2008, to the
+ * extent required to support the CLOCK_REALTIME feature, with
+ * the remainder of its features remaining optional.  We choose
+ * to provide a subset, supporting CLOCK_MONOTONIC in addition
+ * to the aforementioned CLOCK_REALTIME feature.
+ *
+ * We define the POSIX clockid_t type as a pointer to an opaque
+ * structure; user code should never need to know details of the
+ * internal layout of this structure.
+ */
+typedef struct __clockid__ *clockid_t;
+
+/* The standard clockid_t entities which we choose to support.
+ */
+extern clockid_t CLOCK_REALTIME;
+extern clockid_t CLOCK_MONOTONIC;
+
+/* Prototypes for the standard POSIX functions which provide the
+ * API to these standard clockid_t entities.
+ */
+int clock_getres (clockid_t, struct timespec *);
+int clock_gettime (clockid_t, struct timespec *);
+int clock_settime (clockid_t, const struct timespec *);
+
+#endif /* _POSIX_C_SOURCE >= 199309L */
 #endif /* _POSIX_C_SOURCE */
 
 _END_C_DECLS