2051N/A * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A#
define NT_TZ_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones" 0N/A#
define WIN_TZ_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones" 0N/A * Registry key names 0N/A (
void *) L
"StandardName",
0N/A (
void *)
"StandardName",
0N/A * Indices to keyNames[] 0N/A * Calls RegQueryValueEx() to get the value for the specified key. If 0N/A * the platform is NT, 2000 or XP, it calls the Unicode 0N/A * version. Otherwise, it calls the ANSI version and converts the 0N/A * value to Unicode. In this case, it assumes that the current ANSI 0N/A * Code Page is the same as the native platform code page (e.g., Code 0N/A * Page 932 for the Japanese Windows systems. 0N/A * `keyIndex' is an index value to the keyNames in Unicode 0N/A * (WCHAR). `keyIndex' + 1 points to its ANSI value. 0N/A * Returns the status value. ERROR_SUCCESS if succeeded, a 0N/A * non-ERROR_SUCCESS value otherwise. 0N/A * Produces custom name "GMT+hh:mm" from the given bias in buffer. 0N/A * Gets the current time zone entry in the "Time Zones" registry. 0N/A * Get the current time zone setting of the platform. 0N/A * Determine if this is an NT system. 0N/A * Determine if auto-daylight time adjustment is turned off. 0N/A * Vista uses the different key name. 0N/A * Vista has the key for the current "Time Zones" entry. 0N/A * Win32 problem: If the length of the standard time name is equal 1295N/A * to (or probably longer than) 32 in the registry, 1295N/A * GetTimeZoneInformation() on NT returns a null string as its 1295N/A * standard time name. We need to work around this problem by 1295N/A * getting the same information from the TimeZoneInformation 1295N/A * registry. The function on Win98 seems to return its key name. 1295N/A * We can't do anything in that case. 0N/A * Open the "Time Zones" registry. 0N/A * If both failed, then give up. 0N/A * Get the number of subkeys of the "Time Zones" registry for 0N/A * Compare to the "Std" value of each subkey and find the entry that 0N/A * matches the current control panel setting. 0N/A * NT 4.0 SP3 fails here since it doesn't have the "Std" 0N/A * entry in the Time Zones registry. 0N/A * Some localized Win32 platforms use a same name to 0N/A * different time zones. So, we can't rely only on the name 0N/A * here. We need to check GMT offsets and transition dates 0N/A * to make sure it's the registry of the current time 0N/A * found matched record, terminate search 0N/A * Get the "MapID" value of the registry to be able to eliminate 0N/A * duplicated key names later. 0N/A * Vista doesn't have mapID. VALUE_UNKNOWN should be returned 0N/A * only for Windows NT. 0N/A * The mapping table file name. 0N/A * Index values for the mapping table. 0N/A * Looks up the mapping table (tzmappings) and returns a Java time 0N/A * value_type is one of the following values: 0N/A * VALUE_KEY for exact key matching 0N/A * VALUE_MAPID for MapID and country-based mapping (this is 0N/A * required for the old Windows, such as NT 4.0 SP3). 0N/A * Ignore comment and blank lines. 3802N/A * When there's no mapID, we need to scan items until the 3802N/A * exact match is found or the end of data is detected. 3802N/A * Found the time zone in the mapping table. 3802N/A * Try to find the most likely time zone. 0N/A * No need to look up the mapping table further. 0N/A * Detects the platform time zone which maps to a Java time zone ID. 0N/A * Returns a GMT-offset-based time zone ID. On Win32, it always return 0N/A * NULL since the fall back is performed in getWinTimeZone().