www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000170

When Created: 07/28/1997 04:11:26
Against DJGPP version: 2.01
By whom: tim@ipi.ac.ru
Abstract: tzname[] has an invalid values
tzname[] has an invalid values which produces a 
"General Protection Fault" independent from
was tzset() called or not.
Also daylight, timezone, altzone are absent but
they are UNIX-standard variables and used in 
several programs.

Workaround added: 09/10/1997 11:22:52
By whom: michael.mauch@gmx.de
   Compile and link this module to your program
   if you want to use tzname[] without getting a SIGSEGV.

#include <time.h>

static void __attribute__ ((constructor)) Set_tzname(void)
  time_t ti;
  struct tm* tm;


  tm = gmtime(&ti);
  tm->tm_mon = 1;
  tm->tm_mday = 1;
  ti = mktime(tm);
  tm = localtime(&ti);
  tzname[0] = tm->tm_zone;

  tm = gmtime(&ti);
  tm->tm_mon = 7;
  tm->tm_mday = 1;
  ti = mktime(tm);
  tm = localtime(&ti);
  tzname[1] = tm->tm_zone;

Solution added: 04/15/1999 11:00:03
By whom: eliz@is.elta.co.il
Upgrade to v2.02, there are no GPFs there.

Fixed in version on 04/15/1999 11:00:29
By whom: eliz@is.elta.co.il

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010