Просмотр исходного кода

Fix {g,s}ettimeofday when !UCLIBC_HAS_REALTIME

The {g,s}ettimeofday functions internally depend on clock_{g,s}ettime,
but the prototypes for those functions in the time.h header are gated
behind the config option UCLIBC_HAS_REALTIME. When building without that
config (e.g. allnoconfig) a compile error occurs. Fix by just adding a
copy of the declaration unconditionally to the relevant translation units.

Fixes: 8ea0140d5 ("Introduce time64 support.")
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
Charles Mirabile 1 месяц назад
Родитель
Сommit
39b64ce85c

+ 2 - 0
libc/sysdeps/linux/common/gettimeofday.c

@@ -14,6 +14,8 @@
 #include "ldso.h"
 #endif
 
+extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
+
 int gettimeofday(struct timeval * tv, __timezone_ptr_t tz) {
     if (!tv)
         return 0;

+ 3 - 0
libc/sysdeps/linux/common/settimeofday.c

@@ -12,6 +12,9 @@
 # include <sys/time.h>
 # include <time.h>
 
+extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
+     __THROW;
+
 int settimeofday(const struct timeval *tv, const struct timezone *tz)
 {
 	if (!tv)