about summary refs log tree commit diff
path: root/time/time.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-12-24 00:40:15 -0500
committerUlrich Drepper <drepper@gmail.com>2012-01-01 07:17:21 -0500
commit74033a2507841cf077e31221de2481ff30b43d51 (patch)
tree4197ce221b38e8576d49388f01e53036b49bb0fb /time/time.h
parent380d7e87dc80978581e73063dff0e264283c0306 (diff)
downloadglibc-74033a2507841cf077e31221de2481ff30b43d51.tar.gz
glibc-74033a2507841cf077e31221de2481ff30b43d51.tar.xz
glibc-74033a2507841cf077e31221de2481ff30b43d51.zip
Implement timespec_get
Diffstat (limited to 'time/time.h')
-rw-r--r--time/time.h43
1 files changed, 30 insertions, 13 deletions
diff --git a/time/time.h b/time/time.h
index fee8d27052..5cb19db29d 100644
--- a/time/time.h
+++ b/time/time.h
@@ -107,10 +107,11 @@ typedef __timer_t timer_t;
 #undef	__need_timer_t
 
 
-#if !defined __timespec_defined &&				\
-    ((defined _TIME_H &&					\
-      (defined __USE_POSIX199309 || defined __USE_MISC)) ||	\
-      defined __need_timespec)
+#if (!defined __timespec_defined					\
+     && ((defined _TIME_H						\
+	  && (defined __USE_POSIX199309 || defined __USE_MISC		\
+	      || defined __USE_ISOC11))					\
+	 || defined __need_timespec))
 # define __timespec_defined	1
 
 # include <bits/types.h>	/* This defines __time_t for us.  */
@@ -142,13 +143,13 @@ struct tm
   int tm_yday;			/* Days in year.[0-365]	*/
   int tm_isdst;			/* DST.		[-1/0/1]*/
 
-#ifdef	__USE_BSD
+# ifdef	__USE_BSD
   long int tm_gmtoff;		/* Seconds east of UTC.  */
   __const char *tm_zone;	/* Timezone abbreviation.  */
-#else
+# else
   long int __tm_gmtoff;		/* Seconds east of UTC.  */
   __const char *__tm_zone;	/* Timezone abbreviation.  */
-#endif
+# endif
 };
 __END_NAMESPACE_STD
 #if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC
@@ -156,7 +157,7 @@ __USING_NAMESPACE_STD(tm)
 #endif
 
 
-#ifdef __USE_POSIX199309
+# ifdef __USE_POSIX199309
 /* POSIX.1b structure for timer start values and intervals.  */
 struct itimerspec
   {
@@ -167,14 +168,23 @@ struct itimerspec
 /* We can use a simple forward declaration.  */
 struct sigevent;
 
-#endif	/* POSIX.1b */
+# endif	/* POSIX.1b */
 
-#ifdef __USE_XOPEN2K
-# ifndef __pid_t_defined
+# ifdef __USE_XOPEN2K
+#  ifndef __pid_t_defined
 typedef __pid_t pid_t;
-#  define __pid_t_defined
+#   define __pid_t_defined
+#  endif
+# endif
+
+
+# ifdef __USE_ISOC11
+/* Time base values for timespec_get.  */
+enum
+  {
+    TIME_UTC = 1
+  };
 # endif
-#endif
 
 
 __BEGIN_NAMESPACE_STD
@@ -353,6 +363,13 @@ extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
 #  endif
 
 
+# ifdef __USE_ISOC11
+/* Set TS to calendar time based in time base BASE.  */
+extern int timespec_get (struct timespec *__ts, int __base)
+     __THROW __nonnull ((1));
+# endif
+
+
 /* Create new per-process timer using CLOCK_ID.  */
 extern int timer_create (clockid_t __clock_id,
 			 struct sigevent *__restrict __evp,