summaryrefslogtreecommitdiffstats
path: root/fs/isofs/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/isofs/util.c')
-rw-r--r--fs/isofs/util.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/fs/isofs/util.c b/fs/isofs/util.c
index b080406cd..75183cc8f 100644
--- a/fs/isofs/util.c
+++ b/fs/isofs/util.c
@@ -84,10 +84,16 @@ isonum_733 (char * p)
return (isonum_731 (p));
}
-/* We have to convert from a MM/DD/YY format to the unix ctime format. We have to
- take into account leap years and all of that good stuff. Unfortunately, the kernel
- does not have the information on hand to take into account daylight savings time,
- so there will be cases (roughly half the time) where the dates are off by one hour. */
+/*
+ * We have to convert from a MM/DD/YY format to the unix ctime format.
+ * We have to take into account leap years and all of that good stuff.
+ * Unfortunately, the kernel does not have the information on hand to
+ * take into account daylight savings time, but it shouldn't matter.
+ * The time stored should be localtime (with or without DST in effect),
+ * and the timezone offset should hold the offset required to get back
+ * to GMT. Thus we should always be correct.
+ */
+
int iso_date(char * p, int flag)
{
int year, month, day, hour ,minute, second, tz;
@@ -121,9 +127,33 @@ int iso_date(char * p, int flag)
if (tz & 0x80)
tz |= (-1 << 8);
- /* timezone offset is unreliable on some disks */
- if (-48 <= tz && tz <= 52)
- crtime += tz * 15 * 60;
+ /*
+ * The timezone offset is unreliable on some disks,
+ * so we make a sanity check. In no case is it ever
+ * more than 13 hours from GMT, which is 52*15min.
+ * The time is always stored in localtime with the
+ * timezone offset being what get added to GMT to
+ * get to localtime. Thus we need to subtract the offset
+ * to get to true GMT, which is what we store the time
+ * as internally. On the local system, the user may set
+ * their timezone any way they wish, of course, so GMT
+ * gets converted back to localtime on the receiving
+ * system.
+ *
+ * NOTE: mkisofs in versions prior to mkisofs-1.10 had
+ * the sign wrong on the timezone offset. This has now
+ * been corrected there too, but if you are getting screwy
+ * results this may be the explaination. If enough people
+ * complain, a user configuration option could be added
+ * to add the timezone offset in with the wrong sign
+ * for 'compatibility' with older discs, but I cannot see how
+ * it will matter that much.
+ *
+ * Thanks to kuhlmav@elec.canterbury.ac.nz (Volker Kuhlmann)
+ * for pointing out the sign error.
+ */
+ if (-52 <= tz && tz <= 52)
+ crtime -= tz * 15 * 60;
}
return crtime;
}