Skip site navigation (1) Skip section navigation (2)

Re: localtime() for win32 problem.

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: localtime() for win32 problem.
Date: 2004-07-29 17:26:28
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE4569B8@algol.sollentuna.se (view raw or flat)
Thread:
Lists: 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

Responses

pgsql-hackers-win32 by date

Next:From: Tom LaneDate: 2004-07-29 17:49:49
Subject: Re: localtime() for win32 problem.
Previous:From: Tom LaneDate: 2004-07-29 17:25:19
Subject: Re: [HACKERS] win32 crash in initdb

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group