[NTG-pdftex] Patch CreationDate

Heiko Oberdiek oberdiek@uni-freiburg.de
Thu, 31 Jul 2003 14:37:19 +0200


On Thu, Jul 31, 2003 at 12:50:59PM +0200, Martin Schroeder wrote:

> On 2003-07-31 12:11:41 +0200, Martin Schröder wrote:
> > On 2003-07-31 00:24:31 +0200, Martin Schröder wrote:
> > > Probably not. %Z gives names, %z only offsets.
> > > date(1) has this:
> > > %z     RFC-822 style numeric timezone (-0500) (a nonstandard extension)
> > 
> > %z is a GNU extension -- Solaris 2.5 doesn't have it.
> 
> Correction: ISO C99

I have not found, whether %z always results in the sign-four-digit format,
if it is supported. If yes, then most test for RFC-822 time zone
names could be dropped.

In my manual page it was marked as glibc extension, so other
systems without can miss support of %z. How the time zone difference
can be calculated there in a save way? Have to be used the following
procedure or are there better ways?

/* test.c */
#include <time.h>
#include <stdio.h>

int main() {

  time_t t1, t2;
  struct tm *tt;
  double diff;
  int diff_mins;

  t1 = time(0);
  tt = gmtime(&t1);
  tt->tm_isdst = -1;
  t2 = mktime(tt);
  diff = difftime(t1, t2);
  diff_mins = (int)diff/60;

  printf("Diff: %c%02d%02d\n", (diff_mins < 0 ? '-' : '+'),
    abs(diff_mins)/60, abs(diff_mins)%60);

  return 0;
}
/* test.c */

Yours sincerely
  Heiko <oberdiek@uni-freiburg.de>
--