Re: localtime() for win32 problem. - Mailing list pgsql-hackers-win32

From Magnus Hagander
Subject Re: localtime() for win32 problem.
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE4569B8@algol.sollentuna.se
Whole thread Raw
In response to localtime() for win32 problem.  ("Korea PostgreSQL Users' Group" <pgsql-kr@postgresql.or.kr>)
Responses Re: localtime() for win32 problem.
List pgsql-hackers-win32
>> ... change pgtz.c following lines 184 and 304 to
>> correctly deal with a NULL return from the native localtime.
>
>Ah, that would seem to be the problem.  Also, has anyone rechecked with
>this version of pgtz to see if we can dispense with testing time zone
>name equality and still pick the right zone on Windows?

Well, it puts me in "Africa/Ceuta" instead of "Europe/Stockholm"... It
picked a couple of TZs correctly in the US, but when I set it to -7
Arizona, the entire postmaster fails to start with "FATAL: postmaster:
could not locate matching postgres executable". (Other -7 timezones do
work.  -7 Arizona works with the check being in there). I had it die on
one other timezone I tested in the US, I thin kit was Atlantic time.


I tested by #ifdefing out the following code from pgtz.c:

        if (systm->tm_isdst >= 0)
        {
            /* Check match of zone names, too */
            if (pgtm->tm_zone == NULL)
                return -1;        /* probably
shouldn't happen */
            memset(cbuf, 0, sizeof(cbuf));
            strftime(cbuf, sizeof(cbuf) - 1, "%Z", systm);
/* zone abbr */
            if (strcmp(TZABBREV(cbuf), pgtm->tm_zone) != 0)
            {
                elog(DEBUG4, "TZ \"%s\" scores %d: at
%ld \"%s\" versus \"%s\"",
                     tzname, i, (long) pgtt,
                     pgtm->tm_zone, cbuf);
                return i;
            }
        }


That's what you wanted tested, right?

//Magnus

pgsql-hackers-win32 by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: [HACKERS] win32 crash in initdb
Next
From: Tom Lane
Date:
Subject: Re: localtime() for win32 problem.