timezone vs _timezone on Windows - Mailing list pgsql-hackers

From Tom Lane
Subject timezone vs _timezone on Windows
Date
Msg-id 7015.1094052804@sss.pgh.pa.us
Whole thread Raw
Responses Re: [pgsql-hackers-win32] timezone vs _timezone on Windows  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
I think I see the real issue behind the recent argument about the
datatype of the timezone variable.  I don't think the datatype matters,
but the name certainly does.  In pgtz.c we have

#if defined(HAVE_STRUCT_TM_TM_ZONE)
    return tm->tm_gmtoff;
#elif defined(HAVE_INT_TIMEZONE)
#ifdef HAVE_UNDERSCORE_TIMEZONE
    return -_timezone;
#else
    return -timezone;
#endif
#else
#error No way to determine TZ? Can this happen?
#endif

but the symbol HAVE_UNDERSCORE_TIMEZONE appears nowhere else ---
certainly it's not set by configure, and never has been.  So the
"_timezone" case is dead code at the moment.

In 7.4, pg_config_manual.h contained

/*
 * Define this if your operating system has _timezone rather than timezone
 */
#if defined(__CYGWIN__) || defined(WIN32)
#define HAVE_INT_TIMEZONE        /* has int _timezone */
#define HAVE_UNDERSCORE_TIMEZONE 1
#endif

but this passage has disappeared from CVS tip.  So given a platform that
has "_timezone" but not "timezone", CVS tip is broken.

I am wondering how changing this would affect the existing, allegedly
working Windows port.  Should we put back the pg_config_manual.h entry?
Should we restrict it to __CYGWIN__ only?

            regards, tom lane

pgsql-hackers by date:

Previous
From: G u i d o B a r o s i o
Date:
Subject: Re: [ADMIN] slower every day
Next
From: "Marc G. Fournier"
Date:
Subject: Re: version upgrade