+ p0 = dos_date & 0xFF;
+ p1 = ((dos_date & 0xFF00) >> 8) & 0xFF;
+ p2 = ((dos_date & 0xFF0000) >> 16) & 0xFF;
+ p3 = ((dos_date & 0xFF000000) >> 24) & 0xFF;
+
+ t.tm_sec = 2 * (p0 & 0x1F);
+ t.tm_min = ((p0 >> 5) & 0xFF) + ((p1 & 0x7) << 3);
+ t.tm_hour = (p1 >> 3) & 0xFF;
+ t.tm_mday = (p2 & 0x1F);
+ t.tm_mon = ((p2 >> 5) & 0xFF) + ((p3 & 0x1) << 3) - 1;
+ t.tm_year = ((p3 >> 1) & 0xFF) + 80;
+
+ t.tm_wday = 1; /* XXX - should not affect the result; why 1? */
+ t.tm_yday = 1; /* XXX - should not affect the result; why 1? */
+ t.tm_isdst = 0; /* XXX - should be -1, to handle DST? */
+
+ /*
+ * XXX - if tm_year is 2038 or later, this might not fit in a
+ * 32-bit time_t.
+ */