Re: [chrony-dev] [PATCH] macOS - weak linkage of clock_gettime (fixed missing include)

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Thu, Mar 12, 2020 at 01:23:33PM +1300, Bryan Christianson wrote:
> Earlier versions of macOS do not provide clock_gettime(). This patch checks for clock_gettime() at run-time and falls back to gettimeofday() if the symbol is not present.

>  LCL_ReadRawTime(struct timespec *ts)
>  {
>  #if HAVE_CLOCK_GETTIME
> +#ifdef MACOSX
> +  SYS_MacOSX_GetTime(CLOCK_REALTIME, ts);
> +  return;
> +#endif
>    if (clock_gettime(CLOCK_REALTIME, ts) < 0)
>      LOG_FATAL("clock_gettime() failed : %s", strerror(errno));

Hm, I don't like this system-specific code here.

How about renaming the SYS_MacOSX_GetTime to clock_gettime and keeping
the semantics so the local code can stay as it is?

-- 
Miroslav Lichvar


--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/