+void
+sys_stat_nanoseconds (struct tar_stat_info *st)
+{
+#if defined(HAVE_STRUCT_STAT_ST_SPARE1)
+ st->atime_nsec = st->stat.st_spare1 * 1000;
+ st->mtime_nsec = st->stat.st_spare2 * 1000;
+ st->ctime_nsec = st->stat.st_spare3 * 1000;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC)
+ st->atime_nsec = st->stat.st_atim.tv_nsec;
+ st->mtime_nsec = st->stat.st_mtim.tv_nsec;
+ st->ctime_nsec = st->stat.st_ctim.tv_nsec;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC)
+ st->atime_nsec = st->stat.st_atimespec.tv_nsec;
+ st->mtime_nsec = st->stat.st_mtimespec.tv_nsec;
+ st->ctime_nsec = st->stat.st_ctimespec.tv_nsec;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
+ st->atime_nsec = st->stat.st_atimensec;
+ st->mtime_nsec = st->stat.st_mtimensec;
+ st->ctime_nsec = st->stat.st_ctimensec;
+#else
+ st->atime_nsec = st->mtime_nsec = st->ctime_nsec = 0;
+#endif
+}
+