Yuen Ho Wong - 2017-09-28

I think a better fix is to do something like this:

#if defined AT_FDCWD && defined UTIME_NOW && defined UTIME_OMIT
    {
        struct timespec times[2];

#if defined OPTK_OS_MACOSX
        times[0] = sbuf.st_atimespec;
        times[1] = sbuf.st_mtimespec;
#else
        times[0] = sbuf.st_atim;
        times[1] = sbuf.st_mtim;
#endif
        if (utimensat(AT_FDCWD, dest_path, times, 0) != 0)
            return -1;
    }
#else  /* legacy utime */
    {
        struct utimbuf utbuf;

        utbuf.actime = sbuf.st_atime;
        utbuf.modtime = sbuf.st_mtime;
        if (utime(dest_path, &utbuf) != 0)
            return -1;
    }
#endif

The reason is on MacOSX 10.13 High Sierra, utimensat() exists and its times param expects nanosecond precision time from timespec's tv_nsec. The supplied patch assumes none of the MacOS versions have utimensat(), this is no longer true.