mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 09:02:44 +00:00
Merge r552,r559 from libarchive.googlecode.com: Support high-resolution
timestamps on Tru64, AIX, and GNU Hurd. Thanks to Björn Jacke.
This commit is contained in:
parent
4797bb9435
commit
eee9002fb2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189466
@ -43,6 +43,18 @@ archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st)
|
||||
archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec);
|
||||
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec);
|
||||
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_N
|
||||
archive_entry_set_atime(entry, st->st_atime, st->st_atime_n);
|
||||
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n);
|
||||
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n);
|
||||
#elif HAVE_STRUCT_STAT_ST_UMTIME
|
||||
archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000);
|
||||
archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000);
|
||||
archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
|
||||
archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000);
|
||||
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000);
|
||||
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000);
|
||||
#else
|
||||
archive_entry_set_atime(entry, st->st_atime, 0);
|
||||
archive_entry_set_ctime(entry, st->st_ctime, 0);
|
||||
|
@ -90,6 +90,18 @@ archive_entry_stat(struct archive_entry *entry)
|
||||
st->st_atim.tv_nsec = archive_entry_atime_nsec(entry);
|
||||
st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry);
|
||||
st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_N
|
||||
st->st_atime_n = archive_entry_atime_nsec(entry);
|
||||
st->st_ctime_n = archive_entry_ctime_nsec(entry);
|
||||
st->st_mtime_n = archive_entry_mtime_nsec(entry);
|
||||
#elif HAVE_STRUCT_STAT_ST_UMTIME
|
||||
st->st_uatime = archive_entry_atime_nsec(entry) / 1000;
|
||||
st->st_uctime = archive_entry_ctime_nsec(entry) / 1000;
|
||||
st->st_umtime = archive_entry_mtime_nsec(entry) / 1000;
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
|
||||
st->st_atime_usec = archive_entry_atime_nsec(entry) / 1000;
|
||||
st->st_ctime_usec = archive_entry_ctime_nsec(entry) / 1000;
|
||||
st->st_mtime_usec = archive_entry_mtime_nsec(entry) / 1000;
|
||||
#endif
|
||||
#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
|
||||
st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry);
|
||||
|
@ -672,6 +672,15 @@ parse_file(struct archive_read *a, struct archive_entry *entry,
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
||||
archive_entry_set_mtime(entry, st->st_mtime,
|
||||
st->st_mtim.tv_nsec);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_N
|
||||
archive_entry_set_mtime(entry, st->st_mtime,
|
||||
st->st_mtime_n);
|
||||
#elif HAVE_STRUCT_STAT_ST_UMTIME
|
||||
archive_entry_set_mtime(entry, st->st_mtime,
|
||||
st->st_umtime*1000);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
|
||||
archive_entry_set_mtime(entry, st->st_mtime,
|
||||
st->st_mtime_usec*1000);
|
||||
#else
|
||||
archive_entry_set_mtime(entry, st->st_mtime, 0);
|
||||
#endif
|
||||
|
@ -2535,19 +2535,25 @@ older(struct stat *st, struct archive_entry *entry)
|
||||
/* Definitely older. */
|
||||
if (st->st_mtimespec.tv_nsec < archive_entry_mtime_nsec(entry))
|
||||
return (1);
|
||||
/* Definitely younger. */
|
||||
if (st->st_mtimespec.tv_nsec > archive_entry_mtime_nsec(entry))
|
||||
return (0);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
||||
/* Definitely older. */
|
||||
if (st->st_mtim.tv_nsec < archive_entry_mtime_nsec(entry))
|
||||
return (1);
|
||||
/* Definitely older. */
|
||||
if (st->st_mtim.tv_nsec > archive_entry_mtime_nsec(entry))
|
||||
return (0);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_N
|
||||
/* older. */
|
||||
if (st->st_mtime_n < archive_entry_mtime_nsec(entry))
|
||||
return (1);
|
||||
#elif HAVE_STRUCT_STAT_ST_UMTIME
|
||||
/* older. */
|
||||
if (st->st_umtime * 1000 < archive_entry_mtime_nsec(entry))
|
||||
return (1);
|
||||
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
|
||||
/* older. */
|
||||
if (st->st_mtime_usec * 1000 < archive_entry_mtime_nsec(entry))
|
||||
return (1);
|
||||
#else
|
||||
/* This system doesn't have high-res timestamps. */
|
||||
#endif
|
||||
/* Same age, so not older. */
|
||||
/* Same age or newer, so not older. */
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user