[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sleep from coreutils-5.0 doesn't work on AIX 4.3.3
From: |
Jim Meyering |
Subject: |
Re: sleep from coreutils-5.0 doesn't work on AIX 4.3.3 |
Date: |
Tue, 06 May 2003 21:50:35 +0200 |
<address@hidden> wrote:
...
> ~/src/orig/coreutils-5.0$ ./src/sleep 5
> ./src/sleep: cannot read realtime clock: Function not implemented
Thank you for the report.
Here's the fix:
* xnanosleep.c (clock_get_realtime): Use gettime.c's gettime function,
rather than an inferior, open-coded version that would fail on
AIX systems due to clock_gettime failing with errno == ENOSYS.
Index: lib/xnanosleep.c
===================================================================
RCS file: /fetish/cu/lib/xnanosleep.c,v
retrieving revision 1.5
diff -u -p -r1.5 xnanosleep.c
--- lib/xnanosleep.c 8 Mar 2003 14:26:48 -0000 1.5
+++ lib/xnanosleep.c 6 May 2003 19:26:22 -0000
@@ -28,16 +28,6 @@
#include <sys/types.h>
#include <time.h>
-#if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
-# define USE_CLOCK_GETTIME 1
-#else
-# define USE_CLOCK_GETTIME 0
-#endif
-
-#if ! USE_CLOCK_GETTIME
-# include <sys/time.h>
-#endif
-
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
@@ -95,18 +85,7 @@ timespec_subtract (struct timespec *diff
struct timespec *
clock_get_realtime (struct timespec *ts)
{
- int fail;
-#if USE_CLOCK_GETTIME
- fail = clock_gettime (CLOCK_REALTIME, ts);
-#else
- struct timeval tv;
- fail = gettimeofday (&tv, NULL);
- if (!fail)
- {
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = 1000 * tv.tv_usec;
- }
-#endif
+ int fail = gettime (ts);
if (fail)
return NULL;