about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-03 04:57:09 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-03 04:57:09 +0000
commitad0e8eb0a565a44fe9616354d4e7556c3df9ae76 (patch)
treec74ddbeeded7e73a8ec30de6a3387bea066791af /sysdeps/posix
parent1e543c0cc620324b04da6891b9b7848da8704411 (diff)
downloadglibc-ad0e8eb0a565a44fe9616354d4e7556c3df9ae76.tar.gz
glibc-ad0e8eb0a565a44fe9616354d4e7556c3df9ae76.tar.xz
glibc-ad0e8eb0a565a44fe9616354d4e7556c3df9ae76.zip
Update.
2003-03-02  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/bits/posix_opt.h: Define
	_POSIX_MONOTONIC_CLOCK.
	* linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Likewise.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/clock_getres.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index 8bf648f51f..91c57629ca 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
 #include <libc-internal.h>
 
 
-#if HP_TIMING_AVAIL
+#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
 /* Clock frequency of the processor.  */
 static long int nsec;
 #endif
@@ -38,24 +38,33 @@ clock_getres (clockid_t clock_id, struct timespec *res)
 
   switch (clock_id)
     {
-    case CLOCK_REALTIME:
-      {
-	long int clk_tck = sysconf (_SC_CLK_TCK);
-
-	if (__builtin_expect (clk_tck != -1, 1))
-	  {
-	    /* This implementation assumes that the realtime clock has a
-	       resolution higher than 1 second.  This is the case for any
-	       reasonable implementation.  */
-	    res->tv_sec = 0;
-	    res->tv_nsec = 1000000000 / clk_tck;
+#define HANDLE_REALTIME \
+      do {								      \
+	long int clk_tck = sysconf (_SC_CLK_TCK);			      \
+									      \
+	if (__builtin_expect (clk_tck != -1, 1))			      \
+	  {								      \
+	    /* This implementation assumes that the realtime clock has a      \
+	       resolution higher than 1 second.  This is the case for any     \
+	       reasonable implementation.  */				      \
+	    res->tv_sec = 0;						      \
+	    res->tv_nsec = 1000000000 / clk_tck;			      \
+									      \
+	    retval = 0;							      \
+	  }								      \
+      } while (0)
+
+#ifdef SYSDEP_GETRES
+      SYSDEP_GETRES;
+#endif
 
-	    retval = 0;
-	  }
-      }
+#ifndef HANDLED_REALTIME
+    case CLOCK_REALTIME:
+      HANDLE_REALTIME;
       break;
+#endif	/* handled REALTIME */
 
-#if HP_TIMING_AVAIL
+#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
     case CLOCK_PROCESS_CPUTIME_ID:
     case CLOCK_THREAD_CPUTIME_ID:
       {