Thread: Timezones on localized windows
This patch attempts to fix the issue with localized timezones on Windows. Recap: When running on a localized windows version, the timezone name returned is also localized, and therefor does not match our lookup table. Solution: The registry contains both the name of the timezone in english and the localized name. The patch adds code to scan the registry for the localized name and gets the english name from that, and then rescans the table. I have tested this on a Swedish WinXP, and it works without problems. The registry layout is the same in Win2k, but I haven't specifically tested it. It's also the same on different languages but again only Swedish is tested. //Magnus
Attachment
"Magnus Hagander" <mha@sollentuna.net> writes: > This patch attempts to fix the issue with localized timezones on > Windows. Applied with minor stylistic adjustments. regards, tom lane
Patch applied. Thanks. This part of the patch was already in CVS: *** 822,829 **** --- 822,832 ---- { int i; char tzname[128]; + char localtzname[128]; time_t t = time(NULL); struct tm *tm = localtime(&t); + HKEY rootKey; + int idx; if (!tm) --------------------------------------------------------------------------- Magnus Hagander wrote: > This patch attempts to fix the issue with localized timezones on > Windows. > > Recap: When running on a localized windows version, the timezone name > returned is also localized, and therefor does not match our lookup > table. > > Solution: The registry contains both the name of the timezone in english > and the localized name. The patch adds code to scan the registry for the > localized name and gets the english name from that, and then rescans the > table. > > I have tested this on a Swedish WinXP, and it works without problems. > The registry layout is the same in Win2k, but I haven't specifically > tested it. It's also the same on different languages but again only > Swedish is tested. > > > //Magnus Content-Description: win32localtz.patch [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
I have backed out my application of the patch because Tom already applied it. I didn't see the merge failure because I assume Tom placed your code in a different part of the code. --------------------------------------------------------------------------- Bruce Momjian wrote: > > Patch applied. Thanks. > > This part of the patch was already in CVS: > > *** 822,829 **** > --- 822,832 ---- > { > int i; > char tzname[128]; > + char localtzname[128]; > time_t t = time(NULL); > struct tm *tm = localtime(&t); > + HKEY rootKey; > + int idx; > > if (!tm) > > --------------------------------------------------------------------------- > > Magnus Hagander wrote: > > This patch attempts to fix the issue with localized timezones on > > Windows. > > > > Recap: When running on a localized windows version, the timezone name > > returned is also localized, and therefor does not match our lookup > > table. > > > > Solution: The registry contains both the name of the timezone in english > > and the localized name. The patch adds code to scan the registry for the > > localized name and gets the english name from that, and then rescans the > > table. > > > > I have tested this on a Swedish WinXP, and it works without problems. > > The registry layout is the same in Win2k, but I haven't specifically > > tested it. It's also the same on different languages but again only > > Swedish is tested. > > > > > > //Magnus > > Content-Description: win32localtz.patch > > [ Attachment, skipping... ] > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > -- > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 359-1001 > + If your life is a hard drive, | 13 Roberts Road > + Christ can be your backup. | Newtown Square, Pennsylvania 19073 > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073