From 649e04abd003fced7d7672df137a1146d3aad298 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 12 Mar 2013 19:49:07 +0000 Subject: [PATCH] Corrected the interpretation of user supplied ECMA-119 timestamp strings --- configure.ac | 7 +++ xorriso/misc_funct.c | 31 ++++++++--- xorriso/xorriso.1 | 19 +++++-- xorriso/xorriso.info | 100 +++++++++++++++++++----------------- xorriso/xorriso.texi | 19 +++++-- xorriso/xorriso_timestamp.h | 2 +- 6 files changed, 113 insertions(+), 65 deletions(-) diff --git a/configure.ac b/configure.ac index 8c1ef65e..8e3ded28 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,13 @@ AC_PROG_INSTALL AC_CHECK_HEADERS() +dnl Check for tm_gmtoff field in struct tm +AC_CHECK_MEMBER([struct tm.tm_gmtoff], + [AC_DEFINE(HAVE_TM_GMTOFF, 1, + [Define this if tm structure includes a tm_gmtoff entry.])], + , + [#include ]) + THREAD_LIBS=-lpthread AC_SUBST(THREAD_LIBS) diff --git a/xorriso/misc_funct.c b/xorriso/misc_funct.c index 2ecc3439..85302f6b 100644 --- a/xorriso/misc_funct.c +++ b/xorriso/misc_funct.c @@ -457,14 +457,20 @@ ex: int Decode_ecma119_format(struct tm *erg, char *text, int flag) -/* YYYYMMDDhhmmsscc */ +/* YYYYMMDDhhmmsscc[LOC] */ /* 2010040711405800 */ { - int i, l, num; + int i, l, num, utc= 1; memset(erg, 0, sizeof(*erg)); erg->tm_isdst= -1; l= strlen(text); + if(l == 19) { + if(strcmp(text + 16, "LOC") != 0) + return(0); + utc= 0; + l= 16; + } if(l != 16) return(0); for(i= 0; i < l; i++) @@ -491,7 +497,7 @@ int Decode_ecma119_format(struct tm *erg, char *text, int flag) erg->tm_sec= 10*(text[12]-'0')+text[13]-'0'; if(erg->tm_sec > 59) return(0); - return(1); + return(1 + !utc); } @@ -575,7 +581,7 @@ time_t Decode_timestring(char *code, time_t *date, int flag) char scale_chr; double value,seconds; struct tm result_tm; - int seconds_valid= 0; + int seconds_valid= 0, ret; *date= 0; if(code[0]=='-' || code[0]=='+' || code[0]=='=' || code[0]=='@'){ @@ -627,10 +633,21 @@ time_t Decode_timestring(char *code, time_t *date, int flag) seconds= mktime(&result_tm); seconds_valid= 1; goto completed; - } else if(Decode_ecma119_format(&result_tm, code, 0)>0) { - /* YYYYMMDDhhmmsscc */ - /* 2010040711405800 */ + } else if((ret= Decode_ecma119_format(&result_tm, code, 0)) > 0) { + /* YYYYMMDDhhmmsscc[UTC] */ + /* 2010040711405800UTC */ seconds= mktime(&result_tm); + if(ret == 1) { + +#ifdef HAVE_TM_GMTOFF + seconds+= result_tm.tm_gmtoff; +#else + if(result_tm.tm_isdst < 0) + result_tm.tm_isdst = 0; + seconds-= timezone - result_tm.tm_isdst * 3600; +#endif + + } seconds_valid= 1; goto completed; } diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index ae0b38ec..d28aae4b 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -9,7 +9,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Version 1.2.7, Mar 05, 2013" +.TH XORRISO 1 "Version 1.2.7, Mar 11, 2013" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -1599,6 +1599,15 @@ scdbackup timestamps: YYMMDD[.hhmm[ss]] .br where "A0" is year 2000, "B0" is 2010, etc. +.br +ECMA\-119 volume timestamps: +.br + YYYYMMDDhhmmsscc +.br +These are normally given as GMT. The suffix "LOC" causes local timezone +conversion. E.g. 2013010720574700, 2013010720574700LOC. +The last two digits cc (centiseconds) will be ignored, but must be present +in order to make the format recognizable. .TP \fB\-alter_date_r\fR type timestring iso_rr_path [***] Like \-alter_date but affecting all files below eventual directories. @@ -2548,7 +2557,7 @@ It is supposed to match this GRUB line: E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). .br Timestrings for the other types may be given as with command \-alter_date. -They are prone to timezone computations. The timestrings "default" or +Some of them are prone to timezone computations. The timestrings "default" or "overridden" cause default settings: "c" and "m" will show the current time of image creation. "x" and "f" will be marked as insignificant. "uuid" will be deactivated. @@ -3506,9 +3515,9 @@ The free space after the next \-commit might be smaller by several MB. This depends on medium type, number of recorded sessions, and drive habits. .TP \fB\-pvd_info\fR -Print various ID strings which can be found in loaded ISO images. Some of -them may be changed by commands like \-volid or \-publisher. For these -IDs \-pvd_info reports what would be written with the next \-commit. +Print various ID strings which can be found in loaded ISO +images. Some of the IDs may be changed by commands like \-volid or \-publisher. +For these IDs \-pvd_info reports what would be written with the next \-commit. .TP .B Navigation in ISO image and disk filesystem: .TP diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index 9a74857d..9049586a 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -1449,6 +1449,12 @@ whether they stem from the loaded image or were newly inserted. scdbackup timestamps: YYMMDD[.hhmm[ss]] where "A0" is year 2000, "B0" is 2010, etc. + ECMA-119 volume timestamps: + YYYYMMDDhhmmsscc + These are normally given as GMT. The suffix "LOC" causes local + timezone conversion. E.g. 2013010720574700, 2013010720574700LOC. + The last two digits cc (centiseconds) will be ignored, but must be + present in order to make the format recognizable. -alter_date_r type timestring iso_rr_path [***] Like -alter_date but affecting all files below eventual @@ -2257,7 +2263,7 @@ according to the setting of command -acl. search --fs-uuid --set YYYY-MM-DD-hh-mm-ss-cc E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). Timestrings for the other types may be given as with command - -alter_date. They are prone to timezone computations. The + -alter_date. Some of them are prone to timezone computations. The timestrings "default" or "overridden" cause default settings: "c" and "m" will show the current time of image creation. "x" and "f" will be marked as insignificant. "uuid" will be deactivated. @@ -3073,9 +3079,9 @@ File: xorriso.info, Node: Inquiry, Next: Navigate, Prev: DialogCtl, Up: Comm -pvd_info Print various ID strings which can be found in loaded ISO images. - Some of them may be changed by commands like -volid or -publisher. - For these IDs -pvd_info reports what would be written with the - next -commit. + Some of the IDs may be changed by commands like -volid or + -publisher. For these IDs -pvd_info reports what would be written + with the next -commit.  File: xorriso.info, Node: Navigate, Next: Verify, Prev: Inquiry, Up: Commands @@ -4686,7 +4692,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -add inserts one or more paths: Insert. (line 45) * -add_plainly inserts one or more paths: Insert. (line 64) * -alter_date sets timestamps in ISO image: Manip. (line 147) -* -alter_date_r sets timestamps in ISO image: Manip. (line 167) +* -alter_date_r sets timestamps in ISO image: Manip. (line 173) * -append_partition adds arbitrary file after image end: Bootable. (line 234) * -application_id sets application id: SetWrite. (line 192) @@ -4773,7 +4779,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -hardlinks controls handling of hard links: Loading. (line 110) * -help prints help text: Scripting. (line 20) * -hfsplus enables production of HFS+ partition: SetWrite. (line 14) -* -hide excludes file names from directory trees: Manip. (line 171) +* -hide excludes file names from directory trees: Manip. (line 177) * -history brings text into readline history: Scripting. (line 44) * -in_charset sets input character set: Loading. (line 92) * -indev acquires a drive for input: AqDrive. (line 24) @@ -5002,7 +5008,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Hard links, control handling, -hardlinks: Loading. (line 110) * HFS+ allocation block size: Bootable. (line 222) * HFS+ serial number: Bootable. (line 219) -* hidden, set in ISO image, -hide: Manip. (line 171) +* hidden, set in ISO image, -hide: Manip. (line 177) * Image reading, cache size, -data_cache_size: Loading. (line 269) * Image, _definition: Model. (line 9) * Image, demand volume ID, -assert_volid: Loading. (line 84) @@ -5149,7 +5155,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Table-of-content, search sessions, -rom_toc_scan: Loading. (line 211) * Table-of-content, show, -toc: Inquiry. (line 28) * Timestamps, set in ISO image, -alter_date: Manip. (line 147) -* Timestamps, set in ISO image, -alter_date_r: Manip. (line 167) +* Timestamps, set in ISO image, -alter_date_r: Manip. (line 173) * Tree, disk, traverse, -findx: Navigate. (line 106) * Tree, ISO, traverse and alter, -find: CmdFind. (line 7) * Verify, check blocks, -check_media: Verify. (line 21) @@ -5205,44 +5211,44 @@ Node: Loading30695 Node: Insert46151 Node: SetInsert56287 Node: Manip64864 -Node: CmdFind73688 -Node: Filter88393 -Node: Writing92949 -Node: SetWrite102337 -Node: Bootable121080 -Node: Jigdo136474 -Node: Charset140721 -Node: Exception143483 -Node: DialogCtl149603 -Node: Inquiry152201 -Node: Navigate158037 -Node: Verify166335 -Node: Restore175367 -Node: Emulation182454 -Node: Scripting192578 -Node: Frontend199739 -Node: Examples207814 -Node: ExDevices208992 -Node: ExCreate209651 -Node: ExDialog210936 -Node: ExGrowing212201 -Node: ExModifying213006 -Node: ExBootable213510 -Node: ExCharset214062 -Node: ExPseudo214883 -Node: ExCdrecord215781 -Node: ExMkisofs216098 -Node: ExGrowisofs217438 -Node: ExException218573 -Node: ExTime219027 -Node: ExIncBackup219486 -Node: ExRestore223478 -Node: ExRecovery224438 -Node: Files225008 -Node: Seealso226307 -Node: Bugreport227030 -Node: Legal227611 -Node: CommandIdx228622 -Node: ConceptIdx244851 +Node: CmdFind74008 +Node: Filter88713 +Node: Writing93269 +Node: SetWrite102657 +Node: Bootable121408 +Node: Jigdo136802 +Node: Charset141049 +Node: Exception143811 +Node: DialogCtl149931 +Node: Inquiry152529 +Node: Navigate158369 +Node: Verify166667 +Node: Restore175699 +Node: Emulation182786 +Node: Scripting192910 +Node: Frontend200071 +Node: Examples208146 +Node: ExDevices209324 +Node: ExCreate209983 +Node: ExDialog211268 +Node: ExGrowing212533 +Node: ExModifying213338 +Node: ExBootable213842 +Node: ExCharset214394 +Node: ExPseudo215215 +Node: ExCdrecord216113 +Node: ExMkisofs216430 +Node: ExGrowisofs217770 +Node: ExException218905 +Node: ExTime219359 +Node: ExIncBackup219818 +Node: ExRestore223810 +Node: ExRecovery224770 +Node: Files225340 +Node: Seealso226639 +Node: Bugreport227362 +Node: Legal227943 +Node: CommandIdx228954 +Node: ConceptIdx245183  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 4eb5a0cb..894b60b4 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -50,7 +50,7 @@ @c man .\" First parameter, NAME, should be all caps @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" other parameters are allowed: see man(7), man(1) -@c man .TH XORRISO 1 "Version 1.2.7, Mar 05, 2013" +@c man .TH XORRISO 1 "Version 1.2.7, Mar 11, 2013" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -1962,6 +1962,15 @@ scdbackup timestamps: YYMMDD[.hhmm[ss]] @* where "A0" is year 2000, "B0" is 2010, etc. +@* +ECMA-119 volume timestamps: +@* + YYYYMMDDhhmmsscc +@* +These are normally given as GMT. The suffix "LOC" causes local timezone +conversion. E.g. 2013010720574700, 2013010720574700LOC. +The last two digits cc (centiseconds) will be ignored, but must be present +in order to make the format recognizable. @c man .TP @item -alter_date_r type timestring iso_rr_path [***] @kindex -alter_date_r sets timestamps in ISO image @@ -3015,7 +3024,7 @@ It is supposed to match this GRUB line: E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). @* Timestrings for the other types may be given as with command -alter_date. -They are prone to timezone computations. The timestrings "default" or +Some of them are prone to timezone computations. The timestrings "default" or "overridden" cause default settings: "c" and "m" will show the current time of image creation. "x" and "f" will be marked as insignificant. "uuid" will be deactivated. @@ -4106,9 +4115,9 @@ This depends on medium type, number of recorded sessions, and drive habits. @item -pvd_info @kindex -pvd_info shows image id strings @cindex Image, show id strings, -pvd_info -Print various ID strings which can be found in loaded ISO images. Some of -them may be changed by commands like -volid or -publisher. For these -IDs -pvd_info reports what would be written with the next -commit. +Print various ID strings which can be found in loaded ISO +images. Some of the IDs may be changed by commands like -volid or -publisher. +For these IDs -pvd_info reports what would be written with the next -commit. @end table @c man .TP @c man .B Navigation in ISO image and disk filesystem: diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index be9493fc..14dcbbe6 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2013.03.12.194637" +#define Xorriso_timestamP "2013.03.12.194842"