// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /************************************************************************* * Copyright (c) 1997-2016, International Business Machines Corporation * and others. All Rights Reserved. ************************************************************************** * * File TIMEZONE.H * * Modification History: * * Date Name Description * 04/21/97 aliu Overhauled header. * 07/09/97 helena Changed createInstance to createDefault. * 08/06/97 aliu Removed dependency on internal header for Hashtable. * 08/10/98 stephen Changed getDisplayName() API conventions to match * 08/19/98 stephen Changed createTimeZone() to never return 0 * 09/02/98 stephen Sync to JDK 1.2 8/31 * - Added getOffset(... monthlen ...) * - Added hasSameRules() * 09/15/98 stephen Added getStaticClassID * 12/03/99 aliu Moved data out of static table into icudata.dll. * Hashtable replaced by new static data structures. * 12/14/99 aliu Made GMT public. * 08/15/01 grhoten Made GMT private and added the getGMT() function ************************************************************************** */ #ifndef TIMEZONE_H #define TIMEZONE_H #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API /** * \file * \brief C++ API: TimeZone object */ #if !UCONFIG_NO_FORMATTING #include "unicode/uobject.h" #include "unicode/unistr.h" #include "unicode/ures.h" #include "unicode/ucal.h" U_NAMESPACE_BEGIN class StringEnumeration; /** * * <code>TimeZone</code> represents a time zone offset, and also figures out daylight * savings. * * <p> * Typically, you get a <code>TimeZone</code> using <code>createDefault</code> * which creates a <code>TimeZone</code> based on the time zone where the program * is running. For example, for a program running in Japan, <code>createDefault</code> * creates a <code>TimeZone</code> object based on Japanese Standard Time. * * <p> * You can also get a <code>TimeZone</code> using <code>createTimeZone</code> along * with a time zone ID. For instance, the time zone ID for the US Pacific * Time zone is "America/Los_Angeles". So, you can get a Pacific Time <code>TimeZone</code> object * with: * \htmlonly<blockquote>\endhtmlonly * <pre> * TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles"); * </pre> * \htmlonly</blockquote>\endhtmlonly * You can use the <code>createEnumeration</code> method to iterate through * all the supported time zone IDs, or the <code>getCanonicalID</code> method to check * if a time zone ID is supported or not. You can then choose a * supported ID to get a <code>TimeZone</code>. * If the time zone you want is not represented by one of the * supported IDs, then you can create a custom time zone ID with * the following syntax: * * \htmlonly<blockquote>\endhtmlonly * <pre> * GMT[+|-]hh[[:]mm] * </pre> * \htmlonly</blockquote>\endhtmlonly * * For example, you might specify GMT+14:00 as a custom * time zone ID. The <code>TimeZone</code> that is returned * when you specify a custom time zone ID uses the specified * offset from GMT(=UTC) and does not observe daylight saving * time. For example, you might specify GMT+14:00 as a custom * time zone ID to create a TimeZone representing 14 hours ahead * of GMT (with no daylight saving time). In addition, * <code>getCanonicalID</code> can also be used to * normalize a custom time zone ID. * * TimeZone is an abstract class representing a time zone. A TimeZone is needed for * Calendar to produce local time for a particular time zone. A TimeZone comprises * three basic pieces of information: * <ul> * <li>A time zone offset; that, is the number of milliseconds to add or subtract * from a time expressed in terms of GMT to convert it to the same time in that * time zone (without taking daylight savings time into account).</li> * <li>Logic necessary to take daylight savings time into account if daylight savings * time is observed in that time zone (e.g., the days and hours on which daylight * savings time begins and ends).</li> * <li>An ID. This is a text string that uniquely identifies the time zone.</li> * </ul> * * (Only the ID is actually implemented in TimeZone; subclasses of TimeZone may handle * daylight savings time and GMT offset in different ways. Currently we have the following * TimeZone subclasses: RuleBasedTimeZone, SimpleTimeZone, and VTimeZone.) * <P> * The TimeZone class contains a static list containing a TimeZone object for every * combination of GMT offset and daylight-savings time rules currently in use in the * world, each with a unique ID. Each ID consists of a region (usually a continent or * ocean) and a city in that region, separated by a slash, (for example, US Pacific * Time is "America/Los_Angeles.") Because older versions of this class used * three- or four-letter abbreviations instead, there is also a table that maps the older * abbreviations to the newer ones (for example, "PST" maps to "America/Los_Angeles"). * Anywhere the API requires an ID, you can use either form. * <P> * To create a new TimeZone, you call the factory function TimeZone::createTimeZone() * and pass it a time zone ID. You can use the createEnumeration() function to * obtain a list of all the time zone IDs recognized by createTimeZone(). * <P> * You can also use TimeZone::createDefault() to create a TimeZone. This function uses * platform-specific APIs to produce a TimeZone for the time zone corresponding to * the client's computer's physical location. For example, if you're in Japan (assuming * your machine is set up correctly), TimeZone::createDefault() will return a TimeZone * for Japanese Standard Time ("Asia/Tokyo"). */ class U_I18N_API TimeZone : public UObject { … }; // ------------------------------------- inline UnicodeString& TimeZone::getID(UnicodeString& ID) const { … } // ------------------------------------- inline void TimeZone::setID(const UnicodeString& ID) { … } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ #endif //_TIMEZONE //eof