From ebeb088c891b84f9434df67d6ae4d2728e95dddf Mon Sep 17 00:00:00 2001 From: kientzle Date: Sat, 7 Mar 2009 00:52:02 +0000 Subject: =?UTF-8?q?Merge=20r552,r559=20from=20libarchive.googlecode.com:?= =?UTF-8?q?=20Support=20high-resolution=20timestamps=20on=20Tru64,=20AIX,?= =?UTF-8?q?=20and=20GNU=20Hurd.=20=20Thanks=20to=20Bj=C3=B6rn=20Jacke.?= 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 ++++++++++++ lib/libarchive/archive_read_support_format_mtree.c | 9 +++++++++ lib/libarchive/archive_write_disk.c | 20 +++++++++++++------- 4 files changed, 46 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/libarchive/archive_entry_copy_stat.c b/lib/libarchive/archive_entry_copy_stat.c index bd88b74..615d3b0 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 9e5f0c2..8b58658 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 ac615c7..309ab25 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 ea19d5e..948aaf7 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); } -- cgit v1.1