]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys_macosx: remove clock_gettime() override function
authorBryan Christianson <bryan@whatroute.net>
Wed, 28 Jan 2026 07:35:44 +0000 (20:35 +1300)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 29 Jan 2026 08:51:33 +0000 (09:51 +0100)
This will also remove a call to gettimeofday() that was used on very
early versions of macOS where clock_gettime was not implemented.

sys_macosx.c

index e3a38ed1891b973ad85656f66ef8022eb5918682..c668bd4b3646c14f403eaf7448e489a646eb9403 100644 (file)
@@ -453,39 +453,6 @@ legacy_MacOSX_Finalise(void)
 
 /* ================================================== */
 
-#if HAVE_CLOCK_GETTIME
-int
-clock_gettime(clockid_t clock_id, struct timespec *ts)
-{
-  /* Check that the system clock_gettime symbol is actually present before
-     attempting to call it. The symbol is available in macOS 10.12
-     and later. */
-
-  static int init = 0;
-  static int (*sys_clock_gettime)(clockid_t, struct timespec *) = NULL;
-  int ret = 0;
-
-  if (!init) {
-    sys_clock_gettime = dlsym(RTLD_NEXT, "clock_gettime");
-    init = 1;
-  }
-
-  if (sys_clock_gettime != NULL) {
-    ret = sys_clock_gettime(clock_id, ts);
-  } else {
-    struct timeval tv;
-
-    if (gettimeofday(&tv, NULL) < 0)
-      LOG_FATAL("gettimeofday() failed : %s", strerror(errno));
-
-    UTI_TimevalToTimespec(&tv, ts);
-  }
-  return ret;
-}
-#endif
-
-/* ================================================== */
-
 void
 SYS_MacOSX_Initialise(void)
 {