|
6 | 6 | * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
7 | 7 | *
|
8 | 8 | * IDENTIFICATION
|
9 |
| - * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.26 2004/09/02 01:03:59 momjian Exp $ |
| 9 | + * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.27 2004/09/02 01:15:06 momjian Exp $ |
10 | 10 | *
|
11 | 11 | *-------------------------------------------------------------------------
|
12 | 12 | */
|
@@ -953,110 +953,6 @@ identify_system_timezone(void)
|
953 | 953 | }
|
954 | 954 | }
|
955 | 955 |
|
956 |
| -/* |
957 |
| - * Localized Windows versions return localized names for the |
958 |
| - * timezones. Scan the registry to find the english name, |
959 |
| - * and then try matching against the table again. |
960 |
| - */ |
961 |
| -ZeroMemory(localtzname,sizeof(localtzname)); |
962 |
| -if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
963 |
| -"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", |
964 |
| -0, |
965 |
| -KEY_READ, |
966 |
| -&rootKey)!=ERROR_SUCCESS) |
967 |
| -{ |
968 |
| -ereport(WARNING, |
969 |
| -(errmsg_internal("could not open registry key to identify Windows timezone \"%s\": %i",tzname, (int)GetLastError()))); |
970 |
| -returnNULL; |
971 |
| -} |
972 |
| - |
973 |
| -for (idx=0; ;idx++) |
974 |
| -{ |
975 |
| -charkeyname[256]; |
976 |
| -charzonename[256]; |
977 |
| -DWORDnamesize=sizeof(keyname); |
978 |
| -FILETIMElastwrite; |
979 |
| -HKEYkey; |
980 |
| -LONGr; |
981 |
| - |
982 |
| -ZeroMemory(keyname,sizeof(keyname)); |
983 |
| - |
984 |
| -if ((r=RegEnumKeyEx(rootKey, |
985 |
| -idx, |
986 |
| -keyname, |
987 |
| -&namesize, |
988 |
| -NULL, |
989 |
| -NULL, |
990 |
| -NULL, |
991 |
| -&lastwrite))!=ERROR_SUCCESS) |
992 |
| -{ |
993 |
| -if (r==ERROR_NO_MORE_ITEMS) |
994 |
| -break; |
995 |
| -ereport(WARNING, |
996 |
| -(errmsg_internal("could not enumerate registry subkeys to identify Windows timezone \"%s\": %i",tzname, (int)r))); |
997 |
| -break; |
998 |
| -} |
999 |
| - |
1000 |
| -if ((r=RegOpenKeyEx(rootKey,keyname,0,KEY_READ,&key))!=ERROR_SUCCESS) |
1001 |
| -{ |
1002 |
| -ereport(WARNING, |
1003 |
| -(errmsg_internal("could not open registry subkey to identify Windows timezone \"%s\": %i",tzname, (int)r))); |
1004 |
| -break; |
1005 |
| -} |
1006 |
| - |
1007 |
| -ZeroMemory(zonename,sizeof(zonename)); |
1008 |
| -namesize=sizeof(zonename); |
1009 |
| -if ((r=RegQueryValueEx(key,"Std",NULL,NULL,zonename,&namesize))!=ERROR_SUCCESS) |
1010 |
| -{ |
1011 |
| -ereport(WARNING, |
1012 |
| -(errmsg_internal("could not query value for 'std' to identify Windows timezone \"%s\": %i",tzname, (int)r))); |
1013 |
| -RegCloseKey(key); |
1014 |
| -break; |
1015 |
| -} |
1016 |
| -if (!strcmp(tzname,zonename)) |
1017 |
| -{ |
1018 |
| -/* Matched zone */ |
1019 |
| -strcpy(localtzname,keyname); |
1020 |
| -RegCloseKey(key); |
1021 |
| -break; |
1022 |
| -} |
1023 |
| -ZeroMemory(zonename,sizeof(zonename)); |
1024 |
| -namesize=sizeof(zonename); |
1025 |
| -if ((r=RegQueryValueEx(key,"Dlt",NULL,NULL,zonename,&namesize))!=ERROR_SUCCESS) |
1026 |
| -{ |
1027 |
| -ereport(WARNING, |
1028 |
| -(errmsg_internal("could not query value for 'dlt' to identify Windows timezone \"%s\": %i",tzname, (int)r))); |
1029 |
| -RegCloseKey(key); |
1030 |
| -break; |
1031 |
| -} |
1032 |
| -if (!strcmp(tzname,zonename)) |
1033 |
| -{ |
1034 |
| -/* Matched DST zone */ |
1035 |
| -strcpy(localtzname,keyname); |
1036 |
| -RegCloseKey(key); |
1037 |
| -break; |
1038 |
| -} |
1039 |
| - |
1040 |
| -RegCloseKey(key); |
1041 |
| -} |
1042 |
| - |
1043 |
| -RegCloseKey(rootKey); |
1044 |
| - |
1045 |
| -if (localtzname[0]) |
1046 |
| -{ |
1047 |
| -/* Found a localized name, so scan for that one too */ |
1048 |
| -for (i=0;win32_tzmap[i].stdname!=NULL;i++) |
1049 |
| -{ |
1050 |
| -if (strcmp(localtzname,win32_tzmap[i].stdname)==0|| |
1051 |
| -strcmp(localtzname,win32_tzmap[i].dstname)==0) |
1052 |
| -{ |
1053 |
| -elog(DEBUG4,"TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")", |
1054 |
| -win32_tzmap[i].pgtzname,tzname,localtzname); |
1055 |
| -returnwin32_tzmap[i].pgtzname; |
1056 |
| -} |
1057 |
| -} |
1058 |
| -} |
1059 |
| - |
1060 | 956 | ereport(WARNING,
|
1061 | 957 | (errmsg("could not find a match for Windows timezone \"%s\"",
|
1062 | 958 | tzname)));
|
|