]> pd.if.org Git - pdclib/commitdiff
<time.h>: define timespec_get, TIME_UTC, to support <threads.h> implementations
authorOwen Shepherd <owen.shepherd@e43.eu>
Thu, 23 Aug 2012 15:25:20 +0000 (16:25 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Thu, 23 Aug 2012 15:25:20 +0000 (16:25 +0100)
includes/time.h
platform/example/internals/_PDCLIB_config.h
platform/win32/internals/_PDCLIB_config.h

index 57db23032f381d11bdaf4e0045466d2aba9bfa70..41075dbc81c9f71d090db9e878ed9041d24945f1 100644 (file)
@@ -17,6 +17,8 @@ typedef _PDCLIB_size_t size_t;
 typedef _PDCLIB_time_t  time_t;\r
 typedef _PDCLIB_clock_t clock_t;\r
 \r
+#define TIME_UTC _PDCLIB_TIME_UTC\r
+\r
 #ifndef _PDCLIB_STRUCT_TIMESPEC_DEFINED\r
 #define _PDCLIB_STRUCT_TIMESPEC_DEFINED\r
 _PDCLIB_DEFINE_STRUCT_TIMESPEC()\r
@@ -27,7 +29,8 @@ _PDCLIB_DEFINE_STRUCT_TIMESPEC()
 _PDCLIB_DEFINE_STRUCT_TM()\r
 #endif\r
 \r
-time_t time(time_t* t) _PDCLIB_nothrow;\r
+time_t time( time_t* t ) _PDCLIB_nothrow;\r
+int timespec_get( struct timespec *ts, int base ) _PDCLIB_nothrow;\r
 \r
 _PDCLIB_END_EXTERN_C\r
 #endif\r
index 15ee828e7bed455fab6525557a3b9a01556c9cb3..0163753dfbb64a6ced89bd8b2f8ff9f410265c17 100644 (file)
@@ -195,6 +195,19 @@ struct _PDCLIB_imaxdiv_t
 #define _PDCLIB_clock double
 #define _PDCLIB_CLOCKS_PER_SEC 1000000
 
+/* <time.h>: TIME_UTC
+ *
+ * The TIME_UTC parameter is passed to the timespec_get function in order to get
+ * the system time in UTC since an implementation defined epoch (not necessarily
+ * the same as that used for time_t). That said, on POSIX the obvious 
+ * implementation of timespec_get for TIME_UTC is to wrap 
+ * clock_gettime(CLOCK_REALTIME, ...), which is defined as time in UTC since the
+ * same epoch.
+ *
+ * This may be any non-zero integer value.
+ */
+#define _PDCLIB_TIME_UTC 1
+
 /* -------------------------------------------------------------------------- */
 /* Floating Point                                                             */
 /* -------------------------------------------------------------------------- */
index 7caa7cbe062a12de2e0ee4f8bda607ff505baf9b..1d233ebd630d00f4067ed84e6f24b5666a8a166a 100644 (file)
@@ -219,6 +219,19 @@ struct _PDCLIB_imaxdiv_t
 #define _PDCLIB_clock double
 #define _PDCLIB_CLOCKS_PER_SEC 1000000
 
+/* <time.h>: TIME_UTC
+ *
+ * The TIME_UTC parameter is passed to the timespec_get function in order to get
+ * the system time in UTC since an implementation defined epoch (not necessarily
+ * the same as that used for time_t). That said, on POSIX the obvious 
+ * implementation of timespec_get for TIME_UTC is to wrap 
+ * clock_gettime(CLOCK_REALTIME, ...), which is defined as time in UTC since the
+ * same epoch.
+ *
+ * This may be any non-zero integer value.
+ */
+#define _PDCLIB_TIME_UTC 1
+
 /* -------------------------------------------------------------------------- */
 /* Floating Point                                                             */
 /* -------------------------------------------------------------------------- */