From 10cebaf9418a6ecd978dc7248e44e30f2e39e078 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Wed, 8 Jan 2003 10:14:11 +0000 Subject: [PATCH] Use tm.tm_zone only when defined. --- scsh/time1.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scsh/time1.c b/scsh/time1.c index 5d8448c..9b0c666 100644 --- a/scsh/time1.c +++ b/scsh/time1.c @@ -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