Use tm.tm_zone only when defined.
This commit is contained in:
parent
6a8b7f6145
commit
10cebaf941
12
scsh/time1.c
12
scsh/time1.c
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The source code is conditionalised by three #ifdef feature macros:
|
/* 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
|
** The char *tzname[2] global variable is POSIX. Everyone provides
|
||||||
** it...except some "classic" versions of SunOS that we still care about
|
** 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
|
** 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.
|
** that happens.
|
||||||
*/
|
*/
|
||||||
{ int error = 0;
|
{ int error = 0;
|
||||||
#ifndef HAVE_TZNAME
|
#ifdef HAVE_TZNAME
|
||||||
char *zone = d.tm_zone; /* Hack it for SunOS. */
|
|
||||||
#else
|
|
||||||
char *zone = tzname[d.tm_isdst];
|
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
|
#endif
|
||||||
char *newzone = Malloc(char, 1+strlen(zone));
|
char *newzone = Malloc(char, 1+strlen(zone));
|
||||||
if( newzone ){
|
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_yday = s48_extract_fixnum(sch_year_day);
|
||||||
d.tm_isdst = (S48_EQ_P (sch_summer, S48_FALSE)) ? 0 : 1;
|
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 */
|
d.tm_zone = s48_extract_string(sch_tz); /* FreeBSD's strftime reads this */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue