[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

patch for time offset calculation in mkisofs pvd



Hi,

ever burned a cd/dvd when in fact you should be celebrating new year's eve? Well, chances are high that those discs got a wrong volume creation/modification/effective time offset, since the year change is ignored by mkisofs. I live in germany, so the correct time offset from gmt/utc is currently (no daylight saving) +0100.

Now take a look at the following:

foo@bar ~/tmp/ $ date
Tue Feb 13 03:27:23 CET 2007
foo@bar ~/tmp/ $ mkdir foo
foo@bar ~/tmp/ $ mkisofs -o bar.iso foo
[...]
foo@bar ~/tmp/ $ hexdump -C bar.iso | grep 000083
00008320  20 20 20 20 20 20 20 20  20 20 20 20 20 32 30 30  |             200|
00008330  37 30 32 31 33 30 33 32  37 34 38 30 30 04 32 30  |7021303274800.20|
00008340  30 37 30 32 31 33 30 33  32 37 34 38 30 30 04 30  |07021303274800.0|
00008350  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 00  |000000000000000.|
00008360  32 30 30 37 30 32 31 33  30 33 32 37 34 38 30 30  |2007021303274800|
00008370  04 01 00 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
00008380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |

As the time offset is recorded as number of 15 min intervals from -48 (west) to +52 (east), the 0x04 at 0x833d, 0x834e and 0x8370 are correct. But look at this:

foo@bar ~/tmp/ $ date 01010000
Mon Jan  1 00:00:00 CET 2007
foo@bar ~/tmp/ $ mkisofs -o bar.iso foo
foo@bar ~/tmp/ $ hexdump -C bar.iso | grep 000083
00008320  20 20 20 20 20 20 20 20  20 20 20 20 20 32 30 30  |             200|
00008330  37 30 31 30 31 30 30 30  30 31 35 30 30 24 32 30  |7010100001500$20|
00008340  30 37 30 31 30 31 30 30  30 30 31 35 30 30 24 30  |07010100001500$0|
00008350  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 00  |000000000000000.|
00008360  32 30 30 37 30 31 30 31  30 30 30 30 31 35 30 30  |2007010100001500|
00008370  24 01 00 20 20 20 20 20  20 20 20 20 20 20 20 20  |$..             |
00008380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |

0x24 is clearly wrong...

The following patch should however fix this small problem:

--- cdrtools-2.01.01.orig/mkisofs/write.c       2006-11-19 22:54:01.000000000 +0100
+++ cdrtools-2.01.01/mkisofs/write.c    2007-02-13 03:10:11.000000000 +0100
@@ -1740,12 +1740,13 @@
                local.tm_hour, local.tm_min, local.tm_sec);

        local.tm_min -= gmt.tm_min;
        local.tm_hour -= gmt.tm_hour;
        local.tm_yday -= gmt.tm_yday;
+       local.tm_year -= gmt.tm_year;
        iso_time[16] = (local.tm_min + 60 *
-                               (local.tm_hour + 24 * local.tm_yday)) / 15;
+                       (local.tm_hour + 24 * (local.tm_year || local.tm_yday))) / 15;

        /* Next we write out the primary descriptor for the disc */
        memset(&vol_desc, 0, sizeof (vol_desc));
        vol_desc.type[0] = ISO_VD_PRIMARY;
        memcpy(vol_desc.id, ISO_STANDARD_ID, sizeof (ISO_STANDARD_ID));

So it is time to go to bed now, as you have seen its quite late...

Greetings
gordan



Reply to: