summaryrefslogtreecommitdiff
path: root/lib/xnanosleep.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-05-08 06:26:00 +0000
committerJim Meyering <jim@meyering.net>2003-05-08 06:26:00 +0000
commitf197628cb2e7192a8a8ba9b841fca068b50dd96d (patch)
treed2aae68891c4b4f9246a49637a3c8df6a860534b /lib/xnanosleep.c
parent96242be0c156535b12ec11a9e109b37a183cee63 (diff)
downloadcoreutils-f197628cb2e7192a8a8ba9b841fca068b50dd96d.tar.xz
(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.
Diffstat (limited to 'lib/xnanosleep.c')
-rw-r--r--lib/xnanosleep.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/lib/xnanosleep.c b/lib/xnanosleep.c
index 195f5499d..097466e12 100644
--- a/lib/xnanosleep.c
+++ b/lib/xnanosleep.c
@@ -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;