From eee9002fb2ebd161dca8891c0e4de94c9ad077e0 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sat, 7 Mar 2009 00:52:02 +0000 Subject: [PATCH] =?UTF-8?q?Merge=20r552,r559=20from=20libarchive.googlecod?= =?UTF-8?q?e.com:=20Support=20high-resolution=20timestamps=20on=20Tru64,?= =?UTF-8?q?=20AIX,=20and=20GNU=20Hurd.=20=20Thanks=20to=20Bj=C3=B6rn=20Jac?= =?UTF-8?q?ke.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/libarchive/archive_entry_copy_stat.c | 12 +++++++++++ lib/libarchive/archive_entry_stat.c | 12 +++++++++++ .../archive_read_support_format_mtree.c | 9 +++++++++ lib/libarchive/archive_write_disk.c | 20 ++++++++++++------- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/lib/libarchive/archive_entry_copy_stat.c b/lib/libarchive/archive_entry_copy_stat.c index bd88b74d26d3..615d3b0b168b 100644 --- a/lib/libarchive/archive_entry_copy_stat.c +++ b/lib/libarchive/archive_entry_copy_stat.c @@ -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); diff --git a/lib/libarchive/archive_entry_stat.c b/lib/libarchive/archive_entry_stat.c index 9e5f0c27c642..8b58658017de 100644 --- a/lib/libarchive/archive_entry_stat.c +++ b/lib/libarchive/archive_entry_stat.c @@ -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); diff --git a/lib/libarchive/archive_read_support_format_mtree.c b/lib/libarchive/archive_read_support_format_mtree.c index ac615c74d12a..309ab254edc2 100644 --- a/lib/libarchive/archive_read_support_format_mtree.c +++ b/lib/libarchive/archive_read_support_format_mtree.c @@ -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 diff --git a/lib/libarchive/archive_write_disk.c b/lib/libarchive/archive_write_disk.c index ea19d5e27653..948aaf7b75b4 100644 --- a/lib/libarchive/archive_write_disk.c +++ b/lib/libarchive/archive_write_disk.c @@ -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); }