> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Tom Lane
> Sent: Thursday, July 15, 2004 9:13 PM
> To: Oliver Jowett
> Cc: Magnus Hagander; Hackers; [EMAIL PROTECTED]
> Subject: Re: [pgsql-hackers-win32] [HACKERS] Weird new time zone 
> 
> 
> Oliver Jowett <[EMAIL PROTECTED]> 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


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to