Thread: Re: [pgsql-hackers-win32] Weird new time zone

Re: [pgsql-hackers-win32] Weird new time zone

From
"Dann Corbit"
Date:
> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Tom Lane
> Sent: Thursday, July 15, 2004 9:13 PM
> To: Oliver Jowett
> Cc: Magnus Hagander; Hackers; pgsql-hackers-win32@postgresql.org
> Subject: Re: [pgsql-hackers-win32] [HACKERS] Weird new time zone
>
>
> Oliver Jowett <oliver@opencloud.com> writes:
> > How about scanning backwards until you have <= 1 choice or decide to
> > give up?
>
> Hmm ... that really seems like not a bad idea.  Scan all the
> available timezones, score each on how far back it goes
> before a mismatch, take the one that goes furthest back.  I'm
> not sure what to do about ties, nor what the minimum "passing
> score" ought to be, but seems like the germ of an answer.
> Comments anyone?

Use the Windows time zone inquiry function:

DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION
lpTimeZoneInformation);

// Where LPTIME_ZONE_INFORMATION is defined as:

typedef struct _TIME_ZONE_INFORMATION
{
   LONG Bias;
   WCHAR StandardName[ 32 ];
   SYSTEMTIME StandardDate;
   LONG StandardBias;
   WCHAR DaylightName[ 32 ];
   SYSTEMTIME DaylightDate;
   LONG DaylightBias
}  TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION;



The Bias parameter of the TIME_ZONE_INFORMATION structure is the
difference, in minutes, between UTC time and local time.

All translations between UTC time and local time are based on the
following formula:

UTC = local time + bias


Re: [pgsql-hackers-win32] Weird new time zone

From
Tom Lane
Date:
"Dann Corbit" <DCorbit@connx.com> writes:
> All translations between UTC time and local time are based on the
> following formula:

> UTC = local time + bias

Surely not.  Or has Windows not heard of daylight-savings time?
Or perhaps they have, but are not aware that the DST laws have
changed often in the past?

Over-simplistic answers are not what we need here.  The data structure
you quote cannot even tell what DST transition dates Windows thinks
are in effect this year, let alone what it thinks the dates were in past
years.

            regards, tom lane