summaryrefslogtreecommitdiff
path: root/lib/libarchive
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2008-02-19 06:02:01 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2008-02-19 06:02:01 +0000
commit54c845efb96e62dde9172c305489d32122698e64 (patch)
treec14ec2fcf3c52567e63390350555da5856fda71a /lib/libarchive
parent334a6ee707ca05705b78e445cc099da72efb0fc3 (diff)
Notes
Diffstat (limited to 'lib/libarchive')
-rw-r--r--lib/libarchive/archive_read_support_format_iso9660.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libarchive/archive_read_support_format_iso9660.c b/lib/libarchive/archive_read_support_format_iso9660.c
index 83e22875bded..80bac08af5f1 100644
--- a/lib/libarchive/archive_read_support_format_iso9660.c
+++ b/lib/libarchive/archive_read_support_format_iso9660.c
@@ -1064,24 +1064,28 @@ time_from_tm(struct tm *t)
if (t->tm_isdst)
t->tm_hour -= 1;
return (mktime(t)); /* Re-convert. */
-#else
- /*
- * If you don't have tm_gmtoff, let's try resetting the timezone
- * (yecch!).
- */
+#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV) && defined(HAVE_TZSET)
+ /* No timegm() and no tm_gmtoff, let's try forcing mktime() to UTC. */
time_t ret;
char *tz;
+ /* Reset the timezone, remember the old one. */
tz = getenv("TZ");
setenv("TZ", "UTC 0", 1);
tzset();
+
ret = mktime(t);
+
+ /* Restore the previous timezone. */
if (tz)
setenv("TZ", tz, 1);
else
unsetenv("TZ");
tzset();
return ret;
+#else
+ /* <sigh> We have no choice but to use localtime instead of UTC. */
+ return (mktime(t));
#endif
}