aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/clock_settime.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2019-02-01 12:19:42 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2019-02-01 12:24:52 +0000
commitb06f4c0094d3c68be39ada0ed26ae99d51f48013 (patch)
treeb9520cb4d8a61e91fade8da9a419ec0b61cfded3 /sysdeps/unix/clock_settime.c
parent83d1cc42d8e6b18a4b6ba53addfdae98c694ea36 (diff)
downloadglibc-b06f4c0094d3c68be39ada0ed26ae99d51f48013.zip
glibc-b06f4c0094d3c68be39ada0ed26ae99d51f48013.tar.gz
glibc-b06f4c0094d3c68be39ada0ed26ae99d51f48013.tar.bz2
Cleanup clock_*time includes
Clock_gettime, settime and getres implementations are unncessarily complex due to using defines and C file inclusion. Simplify the code by replacing the redundant defines and removing the inclusion, making it much easier to understand. No functional changes. * sysdeps/posix/clock_getres.c (__clock_getres): Cleanup. * sysdeps/unix/clock_gettime.c (__clock_gettime): Cleanup. * sysdeps/unix/clock_settime.c (__clock_settime): Cleanup. * sysdeps/unix/sysv/linux/clock_getres.c (__clock_getres): Cleanup. * sysdeps/unix/sysv/linux/clock_gettime.c (__clock_gettime): Cleanup. * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Cleanup.
Diffstat (limited to 'sysdeps/unix/clock_settime.c')
-rw-r--r--sysdeps/unix/clock_settime.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index b589e87..dcf9ff6 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -21,7 +21,7 @@
#include <ldsodefs.h>
-#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
+#if HP_TIMING_AVAIL
/* Clock frequency of the processor. We make it a 64-bit variable
because some jokers are already playing with processors with more
than 4GHz. */
@@ -84,29 +84,15 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
switch (clock_id)
{
-#define HANDLE_REALTIME \
- do { \
- struct timeval tv; \
- TIMESPEC_TO_TIMEVAL (&tv, tp); \
- \
- retval = __settimeofday (&tv, NULL); \
- } while (0)
-
-#ifdef SYSDEP_SETTIME
- SYSDEP_SETTIME;
-#endif
-
-#ifndef HANDLED_REALTIME
case CLOCK_REALTIME:
- HANDLE_REALTIME;
+ {
+ struct timeval tv;
+ TIMESPEC_TO_TIMEVAL (&tv, tp);
+ retval = __settimeofday (&tv, NULL);
+ }
break;
-#endif
default:
-#ifdef SYSDEP_SETTIME_CPU
- SYSDEP_SETTIME_CPU;
-#endif
-#ifndef HANDLED_CPUTIME
# if HP_TIMING_AVAIL
if (CPUCLOCK_WHICH (clock_id) == CLOCK_PROCESS_CPUTIME_ID
|| CPUCLOCK_WHICH (clock_id) == CLOCK_THREAD_CPUTIME_ID)
@@ -117,7 +103,6 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
__set_errno (EINVAL);
retval = -1;
}
-#endif
break;
}