ISO images generated by cdmake have invalid time and date.
Patch by Aleksandar Andrejevic, aka. [TheFlash]

CORE-7163 #resolve #comment Committed in revision r58932, thanks for the patch ;)

svn path=/trunk/; revision=58932
This commit is contained in:
Hermès Bélusca-Maïto 2013-05-04 22:15:26 +00:00
parent 819b46d5a8
commit b914d7bd8e

View file

@ -1097,6 +1097,20 @@ static void get_file_specifications(PDIR_RECORD d)
}
}
static void get_time_string(char *str)
{
struct tm *current;
time_t timestamp = time(NULL);
current = gmtime(&timestamp);
sprintf(str, "%04d%02d%02d%02d%02d%02d00",
current->tm_year + 1900,
current->tm_mon,
current->tm_mday,
current->tm_hour,
current->tm_min,
current->tm_sec);
}
static void pass(void)
{
PDIR_RECORD d;
@ -1110,6 +1124,9 @@ static void pass(void)
char *old_end_source;
int n;
FILE *file;
char timestring[17];
get_time_string(timestring);
// first 16 sectors are zeros
@ -1144,13 +1161,13 @@ static void pass(void)
write_block(37, ' '); // copyright file identifier
write_block(37, ' '); // abstract file identifier
write_block(37, ' '); // bibliographic file identifier
write_string("0000000000000000"); // volume creation
write_string(timestring); // volume creation
write_byte(0);
write_string("0000000000000000"); // most recent modification
write_string(timestring); // most recent modification
write_byte(0);
write_string("0000000000000000"); // volume expires
write_string(timestring); // volume expires
write_byte(0);
write_string("0000000000000000"); // volume is effective
write_string(timestring); // volume is effective
write_byte(0);
write_byte(1);
write_byte(0);
@ -1203,14 +1220,14 @@ static void pass(void)
write_block(37, ' '); // copyright file identifier
write_block(37, ' '); // abstract file identifier
write_block(37, ' '); // bibliographic file identifier
write_string("0000000000000000"); // volume creation
write_byte(0);
write_string("0000000000000000"); // most recent modification
write_byte(0);
write_string("0000000000000000"); // volume expires
write_byte(0);
write_string("0000000000000000"); // volume is effective
write_byte(0);
write_string(timestring); // volume creation
write_byte(48);
write_string(timestring); // most recent modification
write_byte(48);
write_string(timestring); // volume expires
write_byte(48);
write_string(timestring); // volume is effective
write_byte(48);
write_byte(1);
write_byte(0);
fill_sector();
@ -1499,6 +1516,8 @@ Program execution starts here.
int main(int argc, char **argv)
{
struct tm *current_time;
time_t timestamp = time(NULL);
BOOL q_option = FALSE;
BOOL v_option = FALSE;
int i;
@ -1520,8 +1539,15 @@ int main(int argc, char **argv)
error_exit("Insufficient memory");
memset(&root, 0, sizeof(root));
current_time = gmtime(&timestamp);
root.level = 1;
root.flags = DIRECTORY_FLAG;
root.date_and_time.year = current_time->tm_year + 1900;
root.date_and_time.month = current_time->tm_mon;
root.date_and_time.day = current_time->tm_mday;
root.date_and_time.hour = current_time->tm_hour;
root.date_and_time.minute = current_time->tm_min;
root.date_and_time.second = current_time->tm_sec;
// initialize CD-ROM write buffer