diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 7d43dc95f2..9f00e53de4 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -213,7 +213,14 @@ ifeq ($(subdir),time)
 sysdep_headers += sys/timex.h bits/timex.h
 
 sysdep_routines += ntp_gettime ntp_gettimex
-endif
+
+tests += \
+  tst-clock_gettime-clobber \
+  tst-gettimeofday-clobber \
+  tst-time-clobber \
+  # tests
+
+endif# $(subdir) == time
 
 ifeq ($(subdir),signal)
 tests-special += $(objpfx)tst-signal-numbers.out
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index cfe9370455..86a72ecf5a 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -64,6 +64,7 @@ libc_hidden_def (__clock_gettime64)
 int
 __clock_gettime (clockid_t clock_id, struct timespec *tp)
 {
+# ifdef __ASSUME_TIME64_SYSCALLS
   int ret;
   struct __timespec64 tp64;
 
@@ -81,6 +82,13 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
     }
 
   return ret;
+# else /* !__ASSUME_TIME64_SYSCALLS */
+#  ifdef HAVE_CLOCK_GETTIME_VSYSCALL
+  return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
+#  else
+  return INLINE_SYSCALL_CALL (clock_gettime, clock_id, tp);
+#  endif
+# endif /* !__ASSUME_TIME64_SYSCALLS */
 }
 #endif
 libc_hidden_def (__clock_gettime)
diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
index 4197be5656..1b353956ea 100644
--- a/sysdeps/unix/sysv/linux/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/gettimeofday.c
@@ -16,18 +16,17 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <dl-vdso.h>
+#include <libc-vdso.h>
 #include <time.h>
 #include <string.h>
+#include <sysdep-vdso.h>
 
 /* Optimize the function call by setting the PLT directly to vDSO symbol.  */
 #ifdef USE_IFUNC_GETTIMEOFDAY
 # include <sysdep.h>
-# include <sysdep-vdso.h>
 
 # ifdef SHARED
-# include <dl-vdso.h>
-# include <libc-vdso.h>
-
 static int
 __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz)
 {
@@ -54,7 +53,7 @@ __gettimeofday (struct timeval *restrict tv, void *restrict tz)
 }
 # endif
 weak_alias (__gettimeofday, gettimeofday)
-#else /* USE_IFUNC_GETTIMEOFDAY  */
+#else /* !USE_IFUNC_GETTIMEOFDAY  */
 /* Conversion of gettimeofday function to support 64 bit time on archs
    with __WORDSIZE == 32 and __TIMESIZE == 32/64  */
 #include <errno.h>
@@ -73,9 +72,12 @@ __gettimeofday64 (struct __timeval64 *restrict tv, void *restrict tz)
   return 0;
 }
 
-# if __TIMESIZE != 64
+# if __TIMESIZE == 64
+weak_alias (__gettimeofday, gettimeofday)
+# else /* __TIMESIZE != 64 */
 libc_hidden_def (__gettimeofday64)
 
+#  ifdef __ASSUME_TIME64_SYSCALL
 int
 __gettimeofday (struct timeval *restrict tv, void *restrict tz)
 {
@@ -92,6 +94,9 @@ __gettimeofday (struct timeval *restrict tv, void *restrict tz)
   *tv = valid_timeval64_to_timeval (tv64);
   return 0;
 }
-# endif
 weak_alias (__gettimeofday, gettimeofday)
-#endif
+#  else /* !__ASSUME_TIME64_SYSCALL */
+#   include <time/gettimeofday.c>
+#  endif /* !__ASSUME_TIME64_SYSCALL */
+# endif
+#endif /* !USE_IFUNC_GETTIMEOFDAY  */
diff --git a/sysdeps/unix/sysv/linux/time.c b/sysdeps/unix/sysv/linux/time.c
index 43fec7d3a7..b194127691 100644
--- a/sysdeps/unix/sysv/linux/time.c
+++ b/sysdeps/unix/sysv/linux/time.c
@@ -16,16 +16,16 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <dl-vdso.h>
+#include <libc-vdso.h>
+#include <sysdep-vdso.h>
+
 /* Optimize the function call by setting the PLT directly to vDSO symbol.  */
 #ifdef USE_IFUNC_TIME
 # include <time.h>
 # include <sysdep.h>
-# include <sysdep-vdso.h>
 
 #ifdef SHARED
-# include <dl-vdso.h>
-# include <libc-vdso.h>
-
 static time_t
 time_syscall (time_t *t)
 {
@@ -46,7 +46,7 @@ time (time_t *t)
   return INLINE_VSYSCALL (time, 1, t);
 }
 # endif /* !SHARED */
-#else /* USE_IFUNC_TIME  */
+#else /* !USE_IFUNC_TIME  */
 # include <time.h>
 # include <time-clockid.h>
 # include <errno.h>
@@ -63,10 +63,13 @@ __time64 (__time64_t *timer)
     *timer = ts.tv_sec;
   return ts.tv_sec;
 }
+# if __TIMESIZE == 64
+weak_alias (__time, time)
 
-# if __TIMESIZE != 64
+# else /* __TIMESIZE != 64 */
 libc_hidden_def (__time64)
 
+#  ifdef __ASSUME_TIME64_SYSCALL
 time_t
 __time (time_t *timer)
 {
@@ -82,6 +85,9 @@ __time (time_t *timer)
     *timer = t;
   return t;
 }
-# endif
 weak_alias (__time, time)
-#endif
+#  else /* !__ASSUME_TIME64_SYSCALL */
+#   include <time/time.c>
+#  endif /* !__ASSUME_TIME64_SYSCALL */
+# endif /* __TIMESIZE != 64 */
+#endif /* !USE_IFUNC_TIME */
diff --git a/sysdeps/unix/sysv/linux/tst-clock_gettime-clobber.c b/sysdeps/unix/sysv/linux/tst-clock_gettime-clobber.c
new file mode 100644
index 0000000000..81a32bd15a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-clock_gettime-clobber.c
@@ -0,0 +1,57 @@
+/* Check that clock_gettime does not clobber errno on success.
+   Copyright (C) 2021 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <time.h>
+#include <support/check.h>
+#include <stdio.h>
+
+static void
+test_clock (clockid_t clk)
+{
+  printf ("info: testing clock: %d\n", (int) clk);
+
+  for (int original_errno = 0; original_errno < 2; ++original_errno)
+    {
+      errno = original_errno;
+      struct timespec ts;
+      if (clock_gettime (clk, &ts) == 0)
+        TEST_COMPARE (errno, original_errno);
+    }
+}
+
+static int
+do_test (void)
+{
+  test_clock (CLOCK_BOOTTIME);
+  test_clock (CLOCK_BOOTTIME_ALARM);
+  test_clock (CLOCK_MONOTONIC);
+  test_clock (CLOCK_MONOTONIC_COARSE);
+  test_clock (CLOCK_MONOTONIC_RAW);
+  test_clock (CLOCK_PROCESS_CPUTIME_ID);
+  test_clock (CLOCK_REALTIME);
+  test_clock (CLOCK_REALTIME_ALARM);
+  test_clock (CLOCK_REALTIME_COARSE);
+#ifdef CLOCK_TAI
+  test_clock (CLOCK_TAI);
+#endif
+  test_clock (CLOCK_THREAD_CPUTIME_ID);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/unix/sysv/linux/tst-gettimeofday-clobber.c b/sysdeps/unix/sysv/linux/tst-gettimeofday-clobber.c
new file mode 100644
index 0000000000..bb9bdb67b0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-gettimeofday-clobber.c
@@ -0,0 +1,37 @@
+/* Check that gettimeofday does not clobber errno.
+   Copyright (C) 2021 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <support/check.h>
+#include <sys/time.h>
+
+static int
+do_test (void)
+{
+  for (int original_errno = 0; original_errno < 2; ++original_errno)
+    {
+      errno = original_errno;
+      struct timeval tv;
+      gettimeofday (&tv, NULL);
+      TEST_COMPARE (errno, original_errno);
+    }
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/unix/sysv/linux/tst-time-clobber.c b/sysdeps/unix/sysv/linux/tst-time-clobber.c
new file mode 100644
index 0000000000..ad83be9be8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-time-clobber.c
@@ -0,0 +1,36 @@
+/* Check that time does not clobber errno.
+   Copyright (C) 2021 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <support/check.h>
+#include <time.h>
+
+static int
+do_test (void)
+{
+  for (int original_errno = 0; original_errno < 2; ++original_errno)
+    {
+      errno = original_errno;
+      time (NULL);
+      TEST_COMPARE (errno, original_errno);
+    }
+  return 0;
+}
+
+#include <support/test-driver.c>
