Use tm.tm_zone only when defined.

This commit is contained in:
mainzelm 2003-01-08 10:14:11 +00:00
parent 6a8b7f6145
commit 10cebaf941
1 changed files with 7 additions and 5 deletions

View File

@ -3,7 +3,7 @@
*/
/* The source code is conditionalised by three #ifdef feature macros:
** HAVE_TZNAME
** HAVE_STRUCT_TM_TM_ZONE/HAVE_TZNAME
** The char *tzname[2] global variable is POSIX. Everyone provides
** it...except some "classic" versions of SunOS that we still care about
** running (People in LCS/AI refuse to switch to Solaris). So, we kluge
@ -161,10 +161,12 @@ s48_value time2date(s48_value sch_t, s48_value sch_zone)
** that happens.
*/
{ int error = 0;
#ifndef HAVE_TZNAME
char *zone = d.tm_zone; /* Hack it for SunOS. */
#else
#ifdef HAVE_TZNAME
char *zone = tzname[d.tm_isdst];
#else
#ifdef HAVE_STRUCT_TM_TM_ZONE
const char *zone = d.tm_zone; /* Hack it for SunOS. */
#endif
#endif
char *newzone = Malloc(char, 1+strlen(zone));
if( newzone ){
@ -330,7 +332,7 @@ s48_value format_date(s48_value sch_fmt, s48_value sch_sec, s48_value sch_min,
d.tm_yday = s48_extract_fixnum(sch_year_day);
d.tm_isdst = (S48_EQ_P (sch_summer, S48_FALSE)) ? 0 : 1;
#ifdef HAVE_TM_ZONE
#ifdef HAVE_STRUCT_TM_TM_ZONE
d.tm_zone = s48_extract_string(sch_tz); /* FreeBSD's strftime reads this */
#endif