Re: [HACKERS] Weird new time zone

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: "Magnus Hagander" <mha(at)sollentuna(dot)net>, "Hackers" <pgsql-hackers(at)postgresql(dot)org>, <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [HACKERS] Weird new time zone
Date: 2004-07-16 04:23:13
Message-ID: 54798A299E68514AB7C4DEBA25F03BE101BB81@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-07-16 04:26:07 Re: How to display privileges in psql
Previous Message Tom Lane 2004-07-16 04:13:09 Re: [HACKERS] Weird new time zone

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2004-07-16 05:03:19 Re: [HACKERS] Weird new time zone
Previous Message Tom Lane 2004-07-16 04:13:09 Re: [HACKERS] Weird new time zone