> -----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