[gs-cvs] rev 6905 - in trunk/gs: doc src

leonardo at ghostscript.com leonardo at ghostscript.com
Tue Jul 11 14:32:55 PDT 2006


Author: leonardo
Date: 2006-07-11 14:32:55 -0700 (Tue, 11 Jul 2006)
New Revision: 6905

Modified:
   trunk/gs/doc/Ps2pdf.htm
   trunk/gs/src/devs.mak
   trunk/gs/src/gdevpdf.c
Log:
Fix (pdfwrite) : More PDF/A-1b complience, continued 3.

DETAILS :

Bug 688742 "PDF/A label missing error in Acrobat preflight", part 2.
Bug 688783 "commit 6892 mis-uses the TZ environmental".

Use CRTL functions to compute the tize zone.
Thanks to SaGS for suggestion.

DIFFERENCES :

None.


Modified: trunk/gs/doc/Ps2pdf.htm
===================================================================
--- trunk/gs/doc/Ps2pdf.htm	2006-07-10 11:00:18 UTC (rev 6904)
+++ trunk/gs/doc/Ps2pdf.htm	2006-07-11 21:32:55 UTC (rev 6905)
@@ -135,43 +135,6 @@
 different name, you must set <b><tt>GSC</tt></b> to the name of the
 executable.
 
-<p>
-The <b><tt>pdfwrite</tt></b> device uses the value of the environment variable <b><tt>TZ</tt></b>
-for generating values of <b><tt>CreationDate</tt></b> and <b><tt>ModDate</tt></b>
-keys of the <b><tt>Info</tt></b> dictionary, and for 
-<b><tt>CreateDate</tt></b> and <b><tt>ModifyDate</tt></b> keys of the document <b><tt>Metadata</tt></b>.
-If the environment variable is not set, the <b><tt>Info</tt></b> dictionary keys do not
-include a time zone specification, and <b><tt>Metadata</tt></b> (if presents)
-specifies the 0th time zone.
-
-Use the commonly known syntax to set the <b><tt>TZ</tt></b> environment variable:
-
-
-<blockquote><b><tt>
-tzn[+ | -]hh[:mm[:ss] ][dzn] 
-</b></tt></blockquote>
-
-<ul>
-<li><b><tt>tzn</tt></b>
-- Three-letter time-zone name, such as PST. You must specify the correct offset from local time to UTC
-(not unused by <b><tt>pdfwrite</tt></b>).
-
-<li><b><tt>hh</tt></b>
-- Difference in hours between UTC and local time. Optionally signed.
-
-<li><b><tt>mm</tt></b>
-- Minutes. Separated from hh by a colon (:).
-
-<li><b><tt>ss</tt></b>
-- Seconds. Separated from mm by a colon (:)
-(not unused by <b><tt>pdfwrite</tt></b>).
-
-<li><b><tt>dzn</tt></b>
-- Three-letter daylight-saving-time zone such as PDT. If daylight saving time is never in effect in the locality, set TZ without a value for dzn. The C run-time library assumes the United States' rules for implementing the calculation of Daylight Saving Time (DST)
-(not unused by <b><tt>pdfwrite</tt></b>).
-</ul>
-
-
 <hr>
 
 <h2><a name="Orientation"></a>Setting page orientation</h2>
@@ -871,10 +834,6 @@
 </tt></b></blockquote>
 
 <p>
-Note that the <b><tt>TZ</tt></b> environment variable is necessary for a proper generation 
-of the document the <b><tt>Metadata</tt></b>. See the <a href="#Usage">Usage</a> for details.
-
-<p>
 <hr>
 <h2><a name="PDFA"></a>Creating a PDF/A document</h2>
 
@@ -896,11 +855,6 @@
 </tt></b></blockquote>
 
 <p>
-Note that the <b><tt>TZ</tt></b> environment variable is necessary for a proper generation 
-of the document the <b><tt>Metadata</tt></b>. See the <a href="#Usage">Usage</a> for details.
-
-
-<p>
 <hr>
 
 <h2><a name="Limitations"></a>Limitations</h2>

Modified: trunk/gs/src/devs.mak
===================================================================
--- trunk/gs/src/devs.mak	2006-07-10 11:00:18 UTC (rev 6904)
+++ trunk/gs/src/devs.mak	2006-07-11 21:32:55 UTC (rev 6905)
@@ -840,7 +840,7 @@
 $(GLOBJ)gdevpdf.$(OBJ) : $(GLSRC)gdevpdf.c $(GDEVH)\
  $(fcntl__h) $(memory__h) $(string__h) $(time__h) $(unistd__h) $(gp_h)\
  $(gdevpdfg_h) $(gdevpdfo_h) $(gdevpdfx_h) $(gdevpdt_h) $(smd5_h) $(sarc4_h)\
- $(gdevpdfb_h) $(gpgetenv_h)
+ $(gdevpdfb_h)
 	$(GLCC) $(GLO_)gdevpdf.$(OBJ) $(C_) $(GLSRC)gdevpdf.c
 
 $(GLOBJ)gdevpdfb.$(OBJ) : $(GLSRC)gdevpdfb.c\

Modified: trunk/gs/src/gdevpdf.c
===================================================================
--- trunk/gs/src/gdevpdf.c	2006-07-10 11:00:18 UTC (rev 6904)
+++ trunk/gs/src/gdevpdf.c	2006-07-11 21:32:55 UTC (rev 6905)
@@ -28,7 +28,6 @@
 #include "gdevpdt.h"
 #include "smd5.h"
 #include "sarc4.h"
-#include "gpgetenv.h"
 
 /* Define the default language level and PDF compatibility level. */
 /* Acrobat 4 (PDF 1.3) is the default. */
@@ -247,34 +246,20 @@
 private void
 write_time_zone(char *buf, int offset)
 {
-    char tz[20];
-    char *p = tz + 3;
-    int zl;
-    int code = gp_getenv("TZ", tz, &zl);
 
-    if (code != 0) {
-	buf[offset] = ')';
-	buf[offset + 1] = 0;
-	return;
-    }
-    p = tz + 3;
-    zl -= 3;
-    if (*p != '+' && *p != '-') {
-	buf[offset] = '+';
-	offset++;
-    } else {
-	buf[offset] = *p;
-	offset++;
-	p++;
-    }
-    memcpy(buf + offset, p, 2);
-    offset += 2;
-    p += 2;
-    if (*p != ':') {
-	memcpy(buf + offset, "'00'", 4); /* Set the default time zone 0. */
-	return;
-    }
-    memcpy(buf + offset, p, 3);
+    time_t t;
+    struct tm tms;
+    int timeoffset, hours, minutes;
+    char s;
+
+    t = time(NULL);
+    tms = *gmtime(&t);
+    timeoffset = (int)difftime(mktime(&tms), t); /* tz+dst, seconds */
+    s = (timeoffset >= 0 ? '+' : '-');
+    minutes = any_abs(timeoffset) / 60;
+    hours = minutes / 60;
+    minutes -= hours * 60;
+    sprintf(buf + offset, "%c%02d:%02d", s, hours, minutes);
 }
 
 /* Initialize the IDs allocated at startup. */



More information about the gs-cvs mailing list