> On 20/08/2016, at 3:38 AM, Miroslav Lichvar <mlich...@redhat.com> wrote: > > On Sat, Aug 20, 2016 at 02:32:33AM +1200, Bryan Christianson wrote: >>> local: add support for clock_gettime() >>> >>> Use clock_gettime() to read the system clock in nanosecond resolution. >> >> Is there any benefit in doing a version of clock_gettime() for macOS ? >> There are system calls that will return nanosec resolution, but we are still >> stuck with adjtime() for adjustment. > > I think only if it's a faster system call then gettimeofday(). As for > resolution, it would change only the transmit timestamp (which is not > very accurate anyway as the kernel/NIC typically delays the packet for > at least few tens of microseconds) and the receive timestamp > (SO_TIMESTAMP) would still be in microseconds.
I think there is a faster system call so it’s probably worth investigating. > > The point of this painful conversion of the code to timespec was to > get ready for HW timestamping. The refclock drivers always calculated > offsets in floating point or integer nanoseconds, so this is only > about NTP. > > So, does the new code build and work for you? I was a bit worried I'd > break it on macOS. :) There is something funky going on with my environment. It works fine if I run configure from the command line and chronyd/chronyc are working OK. But when building under the IDE (Xcode), it is finding clock_gettime() somewhere and adding #define HAVE_CLOCK_GETTIME 1 to config.h and then there is a runtime failure. Dyld Error Message: Symbol not found: _clock_gettime Referenced from: /usr/local/sbin/chronyd Expected in: /usr/lib/libSystem.B.dylib I must be linking against a newer version of the library than is used in the runtime path. I am running beta level Xcode/compilers/headers getting ready for the next release of macOS so it will be something to do with that. I must be picking up a changed header in the beta include tree. Interesting to see that it happens - maybe we will be able to get rid of adjtime() I’ll keep you posted. -- Bryan Christianson br...@whatroute.net -- To unsubscribe email chrony-dev-requ...@chrony.tuxfamily.org with "unsubscribe" in the subject. For help email chrony-dev-requ...@chrony.tuxfamily.org with "help" in the subject. Trouble? Email listmas...@chrony.tuxfamily.org.