1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/************************************************************************* 21b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert* Copyright (c) 1997-2015, International Business Machines Corporation 3b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* and others. All Rights Reserved. 4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru************************************************************************** 5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* File TIMEZONE.H 7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Modification History: 9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Date Name Description 11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 04/21/97 aliu Overhauled header. 12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 07/09/97 helena Changed createInstance to createDefault. 13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 08/06/97 aliu Removed dependency on internal header for Hashtable. 14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 08/10/98 stephen Changed getDisplayName() API conventions to match 15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 08/19/98 stephen Changed createTimeZone() to never return 0 16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 09/02/98 stephen Sync to JDK 1.2 8/31 17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* - Added getOffset(... monthlen ...) 18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* - Added hasSameRules() 19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 09/15/98 stephen Added getStaticClassID 20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 12/03/99 aliu Moved data out of static table into icudata.dll. 21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Hashtable replaced by new static data structures. 22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 12/14/99 aliu Made GMT public. 23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 08/15/01 grhoten Made GMT private and added the getGMT() function 24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru************************************************************************** 25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef TIMEZONE_H 28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define TIMEZONE_H 29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h" 31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file 34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \brief C++ API: TimeZone object 35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING 38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uobject.h" 40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/unistr.h" 41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/ures.h" 42b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho#include "unicode/ucal.h" 43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_BEGIN 45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass StringEnumeration; 47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code>TimeZone</code> represents a time zone offset, and also figures out daylight 51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * savings. 52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Typically, you get a <code>TimeZone</code> using <code>createDefault</code> 55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which creates a <code>TimeZone</code> based on the time zone where the program 56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is running. For example, for a program running in Japan, <code>createDefault</code> 57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * creates a <code>TimeZone</code> object based on Japanese Standard Time. 58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * You can also get a <code>TimeZone</code> using <code>createTimeZone</code> along 61b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * with a time zone ID. For instance, the time zone ID for the US Pacific 62b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Time zone is "America/Los_Angeles". So, you can get a Pacific Time <code>TimeZone</code> object 63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * with: 64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \htmlonly<blockquote>\endhtmlonly 65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <pre> 66b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles"); 67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </pre> 68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \htmlonly</blockquote>\endhtmlonly 69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * You can use <code>getAvailableIDs</code> method to iterate through 70103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * all the supported time zone IDs, or getCanonicalID method to check 71103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * if a time zone ID is supported or not. You can then choose a 72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * supported ID to get a <code>TimeZone</code>. 73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the time zone you want is not represented by one of the 74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * supported IDs, then you can create a custom time zone ID with 75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the following syntax: 76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \htmlonly<blockquote>\endhtmlonly 78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <pre> 79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * GMT[+|-]hh[[:]mm] 80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </pre> 81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \htmlonly</blockquote>\endhtmlonly 82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For example, you might specify GMT+14:00 as a custom 84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * time zone ID. The <code>TimeZone</code> that is returned 85103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * when you specify a custom time zone ID uses the specified 86103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * offset from GMT(=UTC) and does not observe daylight saving 87103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * time. For example, you might specify GMT+14:00 as a custom 88103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * time zone ID to create a TimeZone representing 14 hours ahead 89103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * of GMT (with no daylight saving time). In addition, 90103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <code>getCanonicalID</code> can also be used to 91103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * normalize a custom time zone ID. 92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * TimeZone is an abstract class representing a time zone. A TimeZone is needed for 94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Calendar to produce local time for a particular time zone. A TimeZone comprises 95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * three basic pieces of information: 96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <ul> 97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <li>A time zone offset; that, is the number of milliseconds to add or subtract 98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from a time expressed in terms of GMT to convert it to the same time in that 99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * time zone (without taking daylight savings time into account).</li> 100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <li>Logic necessary to take daylight savings time into account if daylight savings 101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * time is observed in that time zone (e.g., the days and hours on which daylight 102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * savings time begins and ends).</li> 103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <li>An ID. This is a text string that uniquely identifies the time zone.</li> 104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </ul> 105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (Only the ID is actually implemented in TimeZone; subclasses of TimeZone may handle 107103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * daylight savings time and GMT offset in different ways. Currently we have the following 108103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * TimeZone subclasses: RuleBasedTimeZone, SimpleTimeZone, and VTimeZone.) 109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The TimeZone class contains a static list containing a TimeZone object for every 111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * combination of GMT offset and daylight-savings time rules currently in use in the 112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * world, each with a unique ID. Each ID consists of a region (usually a continent or 113b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * ocean) and a city in that region, separated by a slash, (for example, US Pacific 114b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Time is "America/Los_Angeles.") Because older versions of this class used 115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * three- or four-letter abbreviations instead, there is also a table that maps the older 116b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * abbreviations to the newer ones (for example, "PST" maps to "America/Los_Angeles"). 117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Anywhere the API requires an ID, you can use either form. 118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * To create a new TimeZone, you call the factory function TimeZone::createTimeZone() 120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and pass it a time zone ID. You can use the createEnumeration() function to 121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * obtain a list of all the time zone IDs recognized by createTimeZone(). 122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * You can also use TimeZone::createDefault() to create a TimeZone. This function uses 124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * platform-specific APIs to produce a TimeZone for the time zone corresponding to 125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the client's computer's physical location. For example, if you're in Japan (assuming 126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * your machine is set up correctly), TimeZone::createDefault() will return a TimeZone 127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for Japanese Standard Time ("Asia/Tokyo"). 128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruclass U_I18N_API TimeZone : public UObject { 130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querupublic: 131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual ~TimeZone(); 135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 137103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Returns the "unknown" time zone. 138103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * It behaves like the GMT/UTC time zone but has the 139103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <code>UCAL_UNKNOWN_ZONE_ID</code> = "Etc/Unknown". 140103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * createTimeZone() returns a mutable clone of this time zone if the input ID is not recognized. 141103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 142103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return the "unknown" time zone. 143103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UCAL_UNKNOWN_ZONE_ID 144103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see createTimeZone 145103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see getGMT 1468393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @stable ICU 49 147103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */ 148103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius static const TimeZone& U_EXPORT2 getUnknown(); 149103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 150103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /** 151103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * The GMT (=UTC) time zone has a raw offset of zero and does not use daylight 152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * savings time. This is a commonly used time zone. 153103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 154103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <p>Note: For backward compatibility reason, the ID used by the time 155103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * zone returned by this method is "GMT", although the ICU's canonical 156103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * ID for the GMT time zone is "Etc/GMT". 157103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 158103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return the GMT/UTC time zone. 159103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see getUnknown 160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static const TimeZone* U_EXPORT2 getGMT(void); 163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates a <code>TimeZone</code> for the given ID. 166b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param ID the ID for a <code>TimeZone</code>, such as "America/Los_Angeles", 167b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * or a custom ID such as "GMT-8:00". 168103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return the specified <code>TimeZone</code>, or a mutable clone of getUnknown() 169103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * if the given ID cannot be understood or if the given ID is "Etc/Unknown". 170103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * The return result is guaranteed to be non-NULL. 171103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * If you require that the specific zone asked for be returned, 172103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * compare the result with getUnknown() or check the ID of the return result. 173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static TimeZone* U_EXPORT2 createTimeZone(const UnicodeString& ID); 176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 177b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho /** 178b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Returns an enumeration over system time zone IDs with the given 179b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * filter conditions. 180b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param zoneType The system time zone type. 181b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param region The ISO 3166 two-letter country code or UN M.49 182b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * three-digit area code. When NULL, no filtering 183b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * done by region. 184b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param rawOffset An offset from GMT in milliseconds, ignoring 185b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * the effect of daylight savings time, if any. 186b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * When NULL, no filtering done by zone offset. 187b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param ec Output param to filled in with a success or 188b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * an error. 189b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return an enumeration object, owned by the caller. 190103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 191b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */ 192b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static StringEnumeration* U_EXPORT2 createTimeZoneIDEnumeration( 193b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho USystemTimeZoneType zoneType, 194b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho const char* region, 195b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho const int32_t* rawOffset, 196b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UErrorCode& ec); 197b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns an enumeration over all recognized time zone IDs. (i.e., 200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all strings that createTimeZone() accepts) 201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return an enumeration object, owned by the caller. 203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static StringEnumeration* U_EXPORT2 createEnumeration(); 206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns an enumeration over time zone IDs with a given raw 209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * offset from GMT. There may be several times zones with the 210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * same GMT offset that differ in the way they handle daylight 211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * savings time. For example, the state of Arizona doesn't 212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * observe daylight savings time. If you ask for the time zone 213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * IDs corresponding to GMT-7:00, you'll get back an enumeration 214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * over two time zone IDs: "America/Denver," which corresponds to 215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Mountain Standard Time in the winter and Mountain Daylight Time 216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the summer, and "America/Phoenix", which corresponds to 217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Mountain Standard Time year-round, even in the summer. 218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rawOffset an offset from GMT in milliseconds, ignoring 220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the effect of daylight savings time, if any 221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return an enumeration object, owned by the caller 222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static StringEnumeration* U_EXPORT2 createEnumeration(int32_t rawOffset); 225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns an enumeration over time zone IDs associated with the 228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * given country. Some zones are affiliated with no country 229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (e.g., "UTC"); these may also be retrieved, as a group. 230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param country The ISO 3166 two-letter country code, or NULL to 232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * retrieve zones not affiliated with any country. 233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return an enumeration object, owned by the caller 234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static StringEnumeration* U_EXPORT2 createEnumeration(const char* country); 237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the number of IDs in the equivalency group that 240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * includes the given ID. An equivalency group contains zones 241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that have the same GMT offset and rules. 242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>The returned count includes the given ID; it is always >= 1. 244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The given ID must be a system time zone. If it is not, returns 245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * zero. 246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param id a system time zone ID 247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the number of zones in the equivalency group containing 248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 'id', or zero if 'id' is not a valid system ID 249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see #getEquivalentID 250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static int32_t U_EXPORT2 countEquivalentIDs(const UnicodeString& id); 253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns an ID in the equivalency group that 256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * includes the given ID. An equivalency group contains zones 257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that have the same GMT offset and rules. 258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>The given index must be in the range 0..n-1, where n is the 260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value returned by <code>countEquivalentIDs(id)</code>. For 261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * some value of 'index', the returned value will be equal to the 262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * given id. If the given id is not a valid system time zone, or 263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if 'index' is out of range, then returns an empty string. 264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param id a system time zone ID 265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param index a value from 0 to n-1, where n is the value 266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * returned by <code>countEquivalentIDs(id)</code> 267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the ID of the index-th zone in the equivalency group 268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * containing 'id', or an empty string if 'id' is not a valid 269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * system ID or 'index' is out of range 270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see #countEquivalentIDs 271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static const UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id, 274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t index); 275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 2761b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#ifndef U_HIDE_DRAFT_API 2771b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert /** 2781b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * Creates an instance of TimeZone detected from the current host 2791b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * system configuration. Note that ICU4C does not change the default 2801b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * time zone unless TimeZone::adoptDefault(TimeZone*) or 2811b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * TimeZone::setDefault(const TimeZone&) is explicitly called by a 2821b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * user. This method does not update the current ICU's default, 2831b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * and may return a different TimeZone from the one returned by 2841b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * TimeZone::createDefault(). 2851b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * 2861b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * @return A new instance of TimeZone detected from the current host system 2871b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * configuration. 2881b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * @draft ICU 55 2891b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert */ 2901b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert static TimeZone* U_EXPORT2 detectHostTimeZone(); 2911b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#endif 2921b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert 293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Creates a new copy of the default TimeZone for this host. Unless the default time 295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * zone has already been set using adoptDefault() or setDefault(), the default is 296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * determined by querying the system using methods in TPlatformUtilities. If the 297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * system routines fail, or if they specify a TimeZone or TimeZone offset which is not 298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * recognized, the TimeZone indicated by the ID kLastResortID is instantiated 299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and made the default. 300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A default TimeZone. Clients are responsible for deleting the time zone 302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * object returned. 303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static TimeZone* U_EXPORT2 createDefault(void); 306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets the default time zone (i.e., what's returned by createDefault()) to be the 309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * specified time zone. If NULL is specified for the time zone, the default time 310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * zone is set to the default host time zone. This call adopts the TimeZone object 31159d709d503bab6e2b61931737e662dd293b40578ccornelius * passed in; the client is no longer responsible for deleting it. 31259d709d503bab6e2b61931737e662dd293b40578ccornelius * 31359d709d503bab6e2b61931737e662dd293b40578ccornelius * <p>This function is not thread safe. It is an error for multiple threads 31459d709d503bab6e2b61931737e662dd293b40578ccornelius * to concurrently attempt to set the default time zone, or for any thread 31559d709d503bab6e2b61931737e662dd293b40578ccornelius * to attempt to reference the default zone while another thread is setting it. 316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param zone A pointer to the new TimeZone object to use as the default. 318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static void U_EXPORT2 adoptDefault(TimeZone* zone); 321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 322103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_SYSTEM_API 323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Same as adoptDefault(), except that the TimeZone object passed in is NOT adopted; 325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the caller remains responsible for deleting it. 326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 32759d709d503bab6e2b61931737e662dd293b40578ccornelius * <p>See the thread safety note under adoptDefault(). 32859d709d503bab6e2b61931737e662dd293b40578ccornelius * 329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param zone The given timezone. 330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @system 331103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 2.0 332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static void U_EXPORT2 setDefault(const TimeZone& zone); 334103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_SYSTEM_API */ 335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the timezone data version currently used by ICU. 338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Output param to filled in with a success or an error. 339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the version string, such as "2007f" 340b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 3.8 341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static const char* U_EXPORT2 getTZDataVersion(UErrorCode& status); 343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 345c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Returns the canonical system timezone ID or the normalized 346c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * custom time zone ID for the given time zone ID. 347b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param id The input time zone ID to be canonicalized. 348b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param canonicalID Receives the canonical system time zone ID 349b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * or the custom time zone ID in normalized format. 350fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status Receives the status. When the given time zone ID 351c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * is neither a known system time zone ID nor a 352b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * valid custom time zone ID, U_ILLEGAL_ARGUMENT_ERROR 353c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * is set. 354c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return A reference to the result. 355b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 356c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 357c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString& id, 358c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UnicodeString& canonicalID, UErrorCode& status); 359c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 360c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru /** 361b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Returns the canonical system time zone ID or the normalized 362c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * custom time zone ID for the given time zone ID. 363b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param id The input time zone ID to be canonicalized. 364b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param canonicalID Receives the canonical system time zone ID 365b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * or the custom time zone ID in normalized format. 366c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param isSystemID Receives if the given ID is a known system 367b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * time zone ID. 368fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status Receives the status. When the given time zone ID 369c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * is neither a known system time zone ID nor a 370b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * valid custom time zone ID, U_ILLEGAL_ARGUMENT_ERROR 371c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * is set. 372c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return A reference to the result. 373b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 374c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 375c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString& id, 376c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UnicodeString& canonicalID, UBool& isSystemID, UErrorCode& status); 377c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 37859d709d503bab6e2b61931737e662dd293b40578ccornelius /** 37959d709d503bab6e2b61931737e662dd293b40578ccornelius * Converts a system time zone ID to an equivalent Windows time zone ID. For example, 38059d709d503bab6e2b61931737e662dd293b40578ccornelius * Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles". 38159d709d503bab6e2b61931737e662dd293b40578ccornelius * 38259d709d503bab6e2b61931737e662dd293b40578ccornelius * <p>There are system time zones that cannot be mapped to Windows zones. When the input 38359d709d503bab6e2b61931737e662dd293b40578ccornelius * system time zone ID is unknown or unmappable to a Windows time zone, then the result will be 38459d709d503bab6e2b61931737e662dd293b40578ccornelius * empty, but the operation itself remains successful (no error status set on return). 38559d709d503bab6e2b61931737e662dd293b40578ccornelius * 38659d709d503bab6e2b61931737e662dd293b40578ccornelius * <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html"> 38759d709d503bab6e2b61931737e662dd293b40578ccornelius * Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes, 38859d709d503bab6e2b61931737e662dd293b40578ccornelius * please read the ICU user guide section <a href="http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data"> 38959d709d503bab6e2b61931737e662dd293b40578ccornelius * Updating the Time Zone Data</a>. 39059d709d503bab6e2b61931737e662dd293b40578ccornelius * 39159d709d503bab6e2b61931737e662dd293b40578ccornelius * @param id A system time zone ID. 39259d709d503bab6e2b61931737e662dd293b40578ccornelius * @param winid Receives a Windows time zone ID. When the input system time zone ID is unknown 39359d709d503bab6e2b61931737e662dd293b40578ccornelius * or unmappable to a Windows time zone ID, then an empty string is set on return. 39459d709d503bab6e2b61931737e662dd293b40578ccornelius * @param status Receives the status. 39559d709d503bab6e2b61931737e662dd293b40578ccornelius * @return A reference to the result (<code>winid</code>). 39659d709d503bab6e2b61931737e662dd293b40578ccornelius * @see getIDForWindowsID 39759d709d503bab6e2b61931737e662dd293b40578ccornelius * 398f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * @stable ICU 52 39959d709d503bab6e2b61931737e662dd293b40578ccornelius */ 40059d709d503bab6e2b61931737e662dd293b40578ccornelius static UnicodeString& U_EXPORT2 getWindowsID(const UnicodeString& id, 40159d709d503bab6e2b61931737e662dd293b40578ccornelius UnicodeString& winid, UErrorCode& status); 40259d709d503bab6e2b61931737e662dd293b40578ccornelius 40359d709d503bab6e2b61931737e662dd293b40578ccornelius /** 40459d709d503bab6e2b61931737e662dd293b40578ccornelius * Converts a Windows time zone ID to an equivalent system time zone ID 40559d709d503bab6e2b61931737e662dd293b40578ccornelius * for a region. For example, system time zone ID "America/Los_Angeles" is returned 40659d709d503bab6e2b61931737e662dd293b40578ccornelius * for input Windows ID "Pacific Standard Time" and region "US" (or <code>null</code>), 40759d709d503bab6e2b61931737e662dd293b40578ccornelius * "America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and 40859d709d503bab6e2b61931737e662dd293b40578ccornelius * region "CA". 40959d709d503bab6e2b61931737e662dd293b40578ccornelius * 41059d709d503bab6e2b61931737e662dd293b40578ccornelius * <p>Not all Windows time zones can be mapped to system time zones. When the input 41159d709d503bab6e2b61931737e662dd293b40578ccornelius * Windows time zone ID is unknown or unmappable to a system time zone, then the result 41259d709d503bab6e2b61931737e662dd293b40578ccornelius * will be empty, but the operation itself remains successful (no error status set on return). 41359d709d503bab6e2b61931737e662dd293b40578ccornelius * 41459d709d503bab6e2b61931737e662dd293b40578ccornelius * <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html"> 41559d709d503bab6e2b61931737e662dd293b40578ccornelius * Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes, 41659d709d503bab6e2b61931737e662dd293b40578ccornelius * please read the ICU user guide section <a href="http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data"> 41759d709d503bab6e2b61931737e662dd293b40578ccornelius * Updating the Time Zone Data</a>. 41859d709d503bab6e2b61931737e662dd293b40578ccornelius * 41959d709d503bab6e2b61931737e662dd293b40578ccornelius * @param winid A Windows time zone ID. 42059d709d503bab6e2b61931737e662dd293b40578ccornelius * @param region A null-terminated region code, or <code>NULL</code> if no regional preference. 42159d709d503bab6e2b61931737e662dd293b40578ccornelius * @param id Receives a system time zone ID. When the input Windows time zone ID is unknown 42259d709d503bab6e2b61931737e662dd293b40578ccornelius * or unmappable to a system time zone ID, then an empty string is set on return. 42359d709d503bab6e2b61931737e662dd293b40578ccornelius * @param status Receives the status. 42459d709d503bab6e2b61931737e662dd293b40578ccornelius * @return A reference to the result (<code>id</code>). 42559d709d503bab6e2b61931737e662dd293b40578ccornelius * @see getWindowsID 42659d709d503bab6e2b61931737e662dd293b40578ccornelius * 427f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * @stable ICU 52 42859d709d503bab6e2b61931737e662dd293b40578ccornelius */ 42959d709d503bab6e2b61931737e662dd293b40578ccornelius static UnicodeString& U_EXPORT2 getIDForWindowsID(const UnicodeString& winid, const char* region, 43059d709d503bab6e2b61931737e662dd293b40578ccornelius UnicodeString& id, UErrorCode& status); 43159d709d503bab6e2b61931737e662dd293b40578ccornelius 432c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru /** 433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns true if the two TimeZones are equal. (The TimeZone version only compares 434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * IDs, but subclasses are expected to also compare the fields they add.) 435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param that The TimeZone object to be compared with. 437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return True if the given TimeZone is equal to this TimeZone; false 438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * otherwise. 439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UBool operator==(const TimeZone& that) const; 442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns true if the two TimeZones are NOT equal; that is, if operator==() returns 445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * false. 446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param that The TimeZone object to be compared with. 448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return True if the given TimeZone is not equal to this TimeZone; false 449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * otherwise. 450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool operator!=(const TimeZone& that) const {return !operator==(that);} 453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add 456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to GMT to get local time in this time zone, taking daylight savings time into 457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * account) as of a particular reference date. The reference date is used to determine 458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * whether daylight savings time is in effect and needs to be figured into the offset 459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that is returned (in other words, what is the adjusted GMT offset in this time zone 460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * at this particular date and time?). For the time zones produced by createTimeZone(), 461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the reference data is specified according to the Gregorian calendar, and the date 462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and time fields are local standard time. 463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload, 465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which returns both the raw and the DST offset for a given time. This method 466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is retained only for backward compatibility. 467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param era The reference date's era 469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param year The reference date's year 470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param month The reference date's month (0-based; 0 is January) 471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param day The reference date's day-in-month (1-based) 472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) 473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param millis The reference date's milliseconds in day, local standard time 474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Output param to filled in with a success or an error. 475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The offset in milliseconds to add to GMT to get local time. 476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, 479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0; 480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the time zone offset, for current date, modified in case of 483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * daylight savings. This is the offset to add *to* UTC to get local time. 484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload, 486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * which returns both the raw and the DST offset for a given time. This method 487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is retained only for backward compatibility. 488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param era the era of the given date. 490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param year the year in the given date. 491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param month the month in the given date. 492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Month is 0-based. e.g., 0 for January. 493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param day the day-in-month of the given date. 494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dayOfWeek the day-of-week of the given date. 495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param milliseconds the millis in day in <em>standard</em> local time. 496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param monthLength the length of the given month in days. 497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Output param to filled in with a success or an error. 498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the offset to add *to* GMT to get local time. 499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, 502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru uint8_t dayOfWeek, int32_t milliseconds, 503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t monthLength, UErrorCode& status) const = 0; 504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the time zone raw and GMT offset for the given moment 507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in time. Upon return, local-millis = GMT-millis + rawOffset + 508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dstOffset. All computations are performed in the proleptic 509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gregorian calendar. The default implementation in the TimeZone 510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * class delegates to the 8-argument getOffset(). 511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param date moment in time for which to return offsets, in 513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * units of milliseconds from January 1, 1970 0:00 GMT, either GMT 514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * time or local wall time, depending on `local'. 515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param local if true, `date' is local wall time; otherwise it 516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is in GMT time. 517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rawOffset output parameter to receive the raw offset, that 518b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is, the offset not including DST adjustments 519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dstOffset output parameter to receive the DST offset, 520b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that is, the offset to be added to `rawOffset' to obtain the 521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * total offset between local and GMT time. If DST is not in 522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * effect, this value is zero; otherwise it is a positive value, 523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * typically one hour. 524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ec input-output error code 525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 527b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 528b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, 529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t& dstOffset, UErrorCode& ec) const; 530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 532b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add 533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to GMT to get local time, before taking daylight savings time into account). 534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param offsetMillis The new raw GMT offset for this time zone. 536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual void setRawOffset(int32_t offsetMillis) = 0; 539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add 542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to GMT to get local time, before taking daylight savings time into account). 543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The TimeZone's raw GMT offset. 545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t getRawOffset(void) const = 0; 548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Fills in "ID" with the TimeZone's ID. 551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ID Receives this TimeZone's ID. 553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A reference to 'ID' 554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString& getID(UnicodeString& ID) const; 557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets the TimeZone's ID to the specified value. This doesn't affect any other 560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * fields (for example, if you say< 561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * blockquote><pre> 562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * . TimeZone* foo = TimeZone::createTimeZone("America/New_York"); 563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * . foo.setID("America/Los_Angeles"); 564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </pre>\htmlonly</blockquote>\endhtmlonly 565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the time zone's GMT offset and daylight-savings rules don't change to those for 566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Los Angeles. They're still those for New York. Only the ID has changed.) 567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 568b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param ID The new time zone ID. 569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru void setID(const UnicodeString& ID); 572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Enum for use with getDisplayName 575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru enum EDisplayType { 578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Selector for short display name 580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru SHORT = 1, 583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Selector for long display name 585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4 586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 58750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho LONG, 58850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 58950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Selector for short generic display name 59027f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 59150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 59250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho SHORT_GENERIC, 59350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 59450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Selector for long generic display name 59527f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 59650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 59750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho LONG_GENERIC, 59850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 59950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Selector for short display name derived 60050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * from time zone offset 60127f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 60250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 60350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho SHORT_GMT, 60450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 60550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Selector for long display name derived 60650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * from time zone offset 60727f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 60850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 60950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho LONG_GMT, 61050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 61150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Selector for short display name derived 61250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * from the time zone's fallback name 61327f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 61450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 61550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho SHORT_COMMONLY_USED, 61650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 61750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Selector for long display name derived 61850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * from the time zone's fallback name 61927f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 62050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 62150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho GENERIC_LOCATION 622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru }; 623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a name of this time zone suitable for presentation to the user 626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the default locale. 627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This method returns the long name, not including daylight savings. 628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the display name is not available for the locale, 629fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * then this method returns a string in the localized GMT offset format 630fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * such as <code>GMT[+-]HH:mm</code>. 631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result the human-readable name of this time zone in the default locale. 632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A reference to 'result'. 633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString& getDisplayName(UnicodeString& result) const; 636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a name of this time zone suitable for presentation to the user 639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the specified locale. 640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This method returns the long name, not including daylight savings. 641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the display name is not available for the locale, 642fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * then this method returns a string in the localized GMT offset format 643fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * such as <code>GMT[+-]HH:mm</code>. 644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale in which to supply the display name. 645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result the human-readable name of this time zone in the given locale 646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or in the default locale if the given locale is not recognized. 647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A reference to 'result'. 648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const; 651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a name of this time zone suitable for presentation to the user 654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the default locale. 655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the display name is not available for the locale, 656fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * then this method returns a string in the localized GMT offset format 657fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * such as <code>GMT[+-]HH:mm</code>. 658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param daylight if true, return the daylight savings name. 65950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param style 660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result the human-readable name of this time zone in the default locale. 661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A reference to 'result'. 662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const; 665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a name of this time zone suitable for presentation to the user 668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in the specified locale. 669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the display name is not available for the locale, 670fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * then this method returns a string in the localized GMT offset format 671fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * such as <code>GMT[+-]HH:mm</code>. 672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param daylight if true, return the daylight savings name. 67350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param style 674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale in which to supply the display name. 675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result the human-readable name of this time zone in the given locale 676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or in the default locale if the given locale is not recognized. 677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A refence to 'result'. 678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const; 68150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Queries if this time zone uses daylight savings time. 684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return true if this time zone uses daylight savings time, 685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * false, otherwise. 686b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * <p><strong>Note:</strong>The default implementation of 687b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * ICU TimeZone uses the tz database, which supports historic 688b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * rule changes, for system time zones. With the implementation, 689b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * there are time zones that used daylight savings time in the 690b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * past, but no longer used currently. For example, Asia/Tokyo has 691b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * never used daylight savings time since 1951. Most clients would 692b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * expect that this method to return <code>FALSE</code> for such case. 693b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The default implementation of this method returns <code>TRUE</code> 694b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * when the time zone uses daylight savings time in the current 695b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * (Gregorian) calendar year. 696103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <p>In Java 7, <code>observesDaylightTime()</code> was added in 697103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * addition to <code>useDaylightTime()</code>. In Java, <code>useDaylightTime()</code> 698103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * only checks if daylight saving time is observed by the last known 699103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * rule. This specification might not be what most users would expect 700103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * if daylight saving time is currently observed, but not scheduled 701103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * in future. In this case, Java's <code>userDaylightTime()</code> returns 702103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <code>false</code>. To resolve the issue, Java 7 added <code>observesDaylightTime()</code>, 703103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * which takes the current rule into account. The method <code>observesDaylightTime()</code> 704103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * was added in ICU4J for supporting API signature compatibility with JDK. 705103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * In general, ICU4C also provides JDK compatible methods, but the current 706103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * implementation <code>userDaylightTime()</code> serves the purpose 707103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * (takes the current rule into account), <code>observesDaylightTime()</code> 708103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * is not added in ICU4C. In addition to <code>useDaylightTime()</code>, ICU4C 709103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * <code>BasicTimeZone</code> class (Note that <code>TimeZone::createTimeZone(const UnicodeString &ID)</code> 710103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * always returns a <code>BasicTimeZone</code>) provides a series of methods allowing 711103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * historic and future time zone rule iteration, so you can check if daylight saving 712103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * time is observed or not within a given period. 713103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * 714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UBool useDaylightTime(void) const = 0; 717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Queries if the given date is in daylight savings time in 720b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this time zone. 721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This method is wasteful since it creates a new GregorianCalendar and 722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * deletes it each time it is called. This is a deprecated method 723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and provided only for Java compatibility. 724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param date the given UDate. 726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Output param filled in with success/error code. 727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return true if the given date is in daylight savings time, 728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * false, otherwise. 729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. 730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0; 732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns true if this zone has the same rule and offset as another zone. 735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * That is, if this zone differs only in ID, if at all. 736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param other the <code>TimeZone</code> object to be compared with 737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return true if the given zone is the same as this one, 738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * with the possible exception of the ID 739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UBool hasSameRules(const TimeZone& other) const; 742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Clones TimeZone objects polymorphically. Clients are responsible for deleting 745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the TimeZone object cloned. 746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A new copy of this TimeZone object. 748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual TimeZone* clone(void) const = 0; 751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Return the class ID for this class. This is useful only for 754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * comparing to a return value from getDynamicClassID(). 755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The class ID for all objects of this class. 756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(void); 759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a unique class ID POLYMORPHICALLY. This method is to 762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * implement a simple version of RTTI, since not all C++ compilers support genuine 763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * RTTI. Polymorphic operator==() and clone() methods call this method. 764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Concrete subclasses of TimeZone must use the UOBJECT_DEFINE_RTTI_IMPLEMENTATION 766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * macro from uobject.h in their implementation to provide correct RTTI information. 767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The class ID for this object. All objects of a given class have the 768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * same class ID. Objects of other classes have different class IDs. 769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 771b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual UClassID getDynamicClassID(void) const = 0; 772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the amount of time to be added to local standard time 775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to get local wall clock time. 776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The default implementation always returns 3600000 milliseconds 778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (i.e., one hour) if this time zone observes Daylight Saving 779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Time. Otherwise, 0 (zero) is returned. 780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 781b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If an underlying TimeZone implementation subclass supports 782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * historical Daylight Saving Time changes, this method returns 783b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the known latest daylight saving value. 784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the amount of saving time in milliseconds 786b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru virtual int32_t getDSTSavings() const; 789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 790103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /** 791b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Gets the region code associated with the given 792b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * system time zone ID. The region code is either ISO 3166 793b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 2-letter country code or UN M.49 3-digit area code. 794b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * When the time zone is not associated with a specific location, 795b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * for example - "Etc/UTC", "EST5EDT", then this method returns 796b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * "001" (UN M.49 area code for World). 797b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 798b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param id The system time zone ID. 799b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param region Output buffer for receiving the region code. 800b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param capacity The size of the output buffer. 801b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status Receives the status. When the given time zone ID 802b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * is not a known system time zone ID, 803b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * U_ILLEGAL_ARGUMENT_ERROR is set. 804b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The length of the output region code. 805103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 806b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */ 807b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static int32_t U_EXPORT2 getRegion(const UnicodeString& id, 808b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho char *region, int32_t capacity, UErrorCode& status); 809b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 810b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruprotected: 811b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 812b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 813b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Default constructor. ID is initialized to the empty string. 814b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 815b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 816b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru TimeZone(); 817b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 818b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 819b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Construct a TimeZone with a given ID. 820b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param id a system time zone ID 821b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 822b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 823b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru TimeZone(const UnicodeString &id); 824b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 825b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copy constructor. 827b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source the object to be copied. 828b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 829b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 830b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru TimeZone(const TimeZone& source); 831b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 833b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Default assignment operator. 834b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param right the object to be copied. 835b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru TimeZone& operator=(const TimeZone& right); 838b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 839103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API 840b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 841b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Utility function. For internally loading rule data. 842b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param top Top resource bundle for tz data 843b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param ruleid ID of rule to load 844b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param oldbundle Old bundle to reuse or NULL 845b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Status parameter 846b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return either a new bundle or *oldbundle 847b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @internal 848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 849b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static UResourceBundle* loadRule(const UResourceBundle* top, const UnicodeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status); 850103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_INTERNAL_API */ 851b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 852b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruprivate: 853b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru friend class ZoneMeta; 854b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 855b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 856b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string. 857b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 858b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 859b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Finds the given ID in the Olson tzdata. If the given ID is found in the tzdata, 860b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * returns the pointer to the ID resource. This method is exposed through ZoneMeta class 861b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * for ICU internal implementation and useful for building hashtable using a time zone 862b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * ID as a key. 863b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param id zone id string 864b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return the pointer of the ID resource, or NULL. 865b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */ 866b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static const UChar* findID(const UnicodeString& id); 867b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 868b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho /** 869c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Resolve a link in Olson tzdata. When the given id is known and it's not a link, 870c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * the id itself is returned. When the given id is known and it is a link, then 871c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * dereferenced zone id is returned. When the given id is unknown, then it returns 87250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * NULL. 87350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param id zone id string 87450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return the dereferenced zone or NULL 875c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 87650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho static const UChar* dereferOlsonLink(const UnicodeString& id); 87750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 87850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 879b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Returns the region code associated with the given zone, 880b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * or NULL if the zone is not known. 88150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param id zone id string 88250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return the region associated with the given zone 88350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 88450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho static const UChar* getRegion(const UnicodeString& id); 885c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 88659d709d503bab6e2b61931737e662dd293b40578ccornelius public: 88759d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_INTERNAL_API 888c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru /** 889b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Returns the region code associated with the given zone, 890b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * or NULL if the zone is not known. 891b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param id zone id string 892b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status Status parameter 893b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return the region associated with the given zone 89459d709d503bab6e2b61931737e662dd293b40578ccornelius * @internal 895b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */ 896b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static const UChar* getRegion(const UnicodeString& id, UErrorCode& status); 89759d709d503bab6e2b61931737e662dd293b40578ccornelius#endif /* U_HIDE_INTERNAL_API */ 898b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 89959d709d503bab6e2b61931737e662dd293b40578ccornelius private: 900b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho /** 901c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Parses the given custom time zone identifier 902c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param id id A string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or 903c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * GMT[+-]hh. 904c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param sign Receves parsed sign, 1 for positive, -1 for negative. 905c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param hour Receives parsed hour field 906c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param minute Receives parsed minute field 907c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param second Receives parsed second field 908c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return Returns TRUE when the given custom id is valid. 909c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 910c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru static UBool parseCustomID(const UnicodeString& id, int32_t& sign, int32_t& hour, 911b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho int32_t& minute, int32_t& second); 912c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 913c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru /** 914c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Parse a custom time zone identifier and return the normalized 915c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * custom time zone identifier for the given custom id string. 916c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param id a string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or 917c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * GMT[+-]hh. 918c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param normalized Receives the normalized custom ID 919c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status Receives the status. When the input ID string is invalid, 920c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * U_ILLEGAL_ARGUMENT_ERROR is set. 921c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return The normalized custom id string. 922c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 923c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru static UnicodeString& getCustomID(const UnicodeString& id, UnicodeString& normalized, 924c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode& status); 925c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 926c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru /** 927b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Returns the normalized custome time zone ID for the given offset fields. 928c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param hour offset hours 929c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param min offset minutes 930c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param sec offset seconds 931b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param negative sign of the offset, TRUE for negative offset. 932c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param id Receves the format result (normalized custom ID) 933c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return The reference to id 934c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 935c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru static UnicodeString& formatCustomID(int32_t hour, int32_t min, int32_t sec, 936c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UBool negative, UnicodeString& id); 937c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 938b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UnicodeString fID; // this time zone's ID 93950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 940b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho friend class TZEnumeration; 941b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}; 942b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 943b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 944b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru// ------------------------------------- 945b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 946b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruinline UnicodeString& 947b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruTimeZone::getID(UnicodeString& ID) const 948b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{ 949b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ID = fID; 950b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru return ID; 951b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 952b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 953b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru// ------------------------------------- 954b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 955b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruinline void 956b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruTimeZone::setID(const UnicodeString& ID) 957b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{ 958b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru fID = ID; 959b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 960b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_END 961b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 962b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */ 963b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 964b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif //_TIMEZONE 965b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru//eof 966