npth-0.90 build report

Werner Koch wk at
Sat May 12 10:19:53 CEST 2012

On Fri, 11 May 2012 21:38, lists at said:
> I decided to publish some code I wrote earlier at github. It
> implements clock_gettime for OS X / darwin. I kindly offer it using a
> dual GPL v2 or LGPL v3 or later license. This may be interesting for

Thanks for that offer.  However, I already implemented it using

  npth_clock_gettime (struct timespec *ts)
    return clock_gettime (CLOCK_REALTIME, ts);
      struct timeval tv;
      if (gettimeofday (&tv, NULL))
        return -1;
      ts->tv_sec = tv.tv_sec;
      ts->tv_nsec = tv.tv_usec * 1000;
      return 0;
    /* FIXME: fall back on time() with seconds resolution.  */
  # error clock_gettime not available - please provide a fallback.

The gotcha was that HAVE_CLOCK_GETTIME alone was not sufficient, a test
for the CLOCK_REALTIME macro was also required.  It would be better to
do the test for CLOCK_REALTIME while testing for clock_gettime, but
well, this was easier.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-devel mailing list