+#if HAVE_FUTIMENS
+ {
+ int result = futimens (fd, timespec);
+# ifdef __linux__
+ /* Work around the same bug as above. */
+ if (0 < result)
+ errno = ENOSYS;
+# endif
+ if (result == 0 || errno != ENOSYS)
+ return result;
+ }
+#endif
+
+ /* The platform lacks an interface to set file timestamps with
+ nanosecond resolution, so do the best we can, discarding any
+ fractional part of the timestamp. */
+ {
+#if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES
+ struct timeval timeval[2];
+ struct timeval const *t;
+ if (timespec)
+ {
+ timeval[0].tv_sec = timespec[0].tv_sec;
+ timeval[0].tv_usec = timespec[0].tv_nsec / 1000;
+ timeval[1].tv_sec = timespec[1].tv_sec;
+ timeval[1].tv_usec = timespec[1].tv_nsec / 1000;
+ t = timeval;
+ }
+ else
+ t = NULL;
+
+ if (fd < 0)
+ {