SimpleTimeZone
is a concrete subclass of TimeZone
that represents a time zone for use with a Gregorian calendar.
More...
#include <simpletz.h>
Inheritance diagram for SimpleTimeZone:
Public Types | |
enum | TimeMode { WALL_TIME = 0, STANDARD_TIME, UTC_TIME } |
TimeMode is used, together with a millisecond offset after midnight, to specify a rule transition time. More... | |
Public Member Functions | |
SimpleTimeZone (const SimpleTimeZone &source) | |
Copy constructor . | |
SimpleTimeZone & | operator= (const SimpleTimeZone &right) |
Default assignment operator . | |
virtual | ~SimpleTimeZone () |
Destructor . | |
virtual UBool | operator== (const TimeZone &that) const |
Returns true if the two TimeZone objects are equal; that is, they have the same ID, raw GMT offset, and DST rules. | |
SimpleTimeZone (int32_t rawOffsetGMT, const UnicodeString &ID) | |
Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID, and which doesn't observe daylight savings time. | |
SimpleTimeZone (int32_t rawOffsetGMT, const UnicodeString &ID, int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, int8_t savingsStartDayOfWeek, int32_t savingsStartTime, int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, int8_t savingsEndDayOfWeek, int32_t savingsEndTime, UErrorCode &status) | |
Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, and times to start and end daylight savings time. | |
SimpleTimeZone (int32_t rawOffsetGMT, const UnicodeString &ID, int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, int8_t savingsStartDayOfWeek, int32_t savingsStartTime, int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, int8_t savingsEndDayOfWeek, int32_t savingsEndTime, int32_t savingsDST, UErrorCode &status) | |
SimpleTimeZone (int32_t rawOffsetGMT, const UnicodeString &ID, int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, int8_t savingsStartDayOfWeek, int32_t savingsStartTime, TimeMode savingsStartTimeMode, int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, int8_t savingsEndDayOfWeek, int32_t savingsEndTime, TimeMode savingsEndTimeMode, int32_t savingsDST, UErrorCode &status) | |
void | setStartYear (int32_t year) |
Sets the daylight savings starting year, that is, the year this time zone began observing its specified daylight savings time rules. | |
void | setStartRule (int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, int32_t time, UErrorCode &status) |
Sets the daylight savings starting rule. | |
void | setStartRule (int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, int32_t time, TimeMode mode, UErrorCode &status) |
void | setStartRule (int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode &status) |
Sets the DST start rule to a fixed date within a month. | |
void | setStartRule (int32_t month, int32_t dayOfMonth, int32_t time, TimeMode mode, UErrorCode &status) |
void | setStartRule (int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, int32_t time, UBool after, UErrorCode &status) |
Sets the DST start rule to a weekday before or after a give date within a month, e.g. | |
void | setStartRule (int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, int32_t time, TimeMode mode, UBool after, UErrorCode &status) |
void | setEndRule (int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, int32_t time, UErrorCode &status) |
Sets the daylight savings ending rule. | |
void | setEndRule (int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, int32_t time, TimeMode mode, UErrorCode &status) |
void | setEndRule (int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode &status) |
Sets the DST end rule to a fixed date within a month. | |
void | setEndRule (int32_t month, int32_t dayOfMonth, int32_t time, TimeMode mode, UErrorCode &status) |
void | setEndRule (int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, int32_t time, UBool after, UErrorCode &status) |
Sets the DST end rule to a weekday before or after a give date within a month, e.g. | |
void | setEndRule (int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, int32_t time, TimeMode mode, UBool after, UErrorCode &status) |
virtual int32_t | getOffset (uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, int32_t millis, UErrorCode &status) const |
Returns the TimeZone's adjusted GMT offset (i.e. | |
virtual int32_t | getOffset (uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, int32_t millis) const |
virtual int32_t | getOffset (uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, int32_t milliseconds, int32_t monthLength, UErrorCode &status) const |
Gets the time zone offset, for current date, modified in case of daylight savings. | |
virtual int32_t | getOffset (uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, int32_t milliseconds, int32_t monthLength, int32_t prevMonthLength, UErrorCode &status) const |
virtual int32_t | getRawOffset (void) const |
Returns the TimeZone's raw GMT offset (i.e. | |
virtual void | setRawOffset (int32_t offsetMillis) |
Sets the TimeZone's raw GMT offset (i.e. | |
void | setDSTSavings (int32_t millisSavedDuringDST, UErrorCode &status) |
Sets the amount of time in ms that the clock is advanced during DST. | |
int32_t | getDSTSavings (void) const |
Returns the amount of time in ms that the clock is advanced during DST. | |
virtual UBool | useDaylightTime (void) const |
Queries if this TimeZone uses Daylight Savings Time. | |
virtual UBool | inDaylightTime (UDate date, UErrorCode &status) const |
Returns true if the given date is within the period when daylight savings time is in effect; false otherwise. | |
UBool | hasSameRules (const TimeZone &other) const |
Return true if this zone has the same rules and offset as another zone. | |
virtual TimeZone * | clone (void) const |
Clones TimeZone objects polymorphically. | |
virtual UClassID | getDynamicClassID (void) const |
Override TimeZone Returns a unique class ID POLYMORPHICALLY. | |
Static Public Member Functions | |
static UClassID | getStaticClassID (void) |
Return the class ID for this class. | |
Friends | |
class | TimeZone |
SimpleTimeZone
is a concrete subclass of TimeZone
that represents a time zone for use with a Gregorian calendar.
This class does not handle historical changes.
When specifying daylight-savings-time begin and end dates, use a negative value for dayOfWeekInMonth
to indicate that SimpleTimeZone
should count from the end of the month backwards. For example, in the U.S., Daylight Savings Time ends at the last (dayOfWeekInMonth = -1) Sunday in October, at 2 AM in standard time.
|
TimeMode is used, together with a millisecond offset after midnight, to specify a rule transition time. Most rules transition at a local wall time, that is, according to the current time in effect, either standard, or DST. However, some rules transition at local standard time, and some at a specific UTC time. Although it might seem that all times could be converted to wall time, thus eliminating the need for this parameter, this is not the case. |
|
Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID, and which doesn't observe daylight savings time. Normally you should use TimeZone::createInstance() to create a TimeZone instead of creating a SimpleTimeZone directly with this constructor.
|
|
Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, and times to start and end daylight savings time. To create a TimeZone that doesn't observe daylight savings time, don't use this constructor; use SimpleTimeZone(rawOffset, ID) instead. Normally, you should use TimeZone.createInstance() to create a TimeZone instead of creating a SimpleTimeZone directly with this constructor. Various types of daylight-savings time rules can be specfied by using different values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a complete explanation of how these parameters work, see the documentation for setStartRule().
|
|
Clones TimeZone objects polymorphically. Clients are responsible for deleting the TimeZone object cloned.
Implements TimeZone. |
|
Returns the amount of time in ms that the clock is advanced during DST.
|
|
Override TimeZone Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic operator==() and clone() methods call this method.
Implements TimeZone. |
|
Gets the time zone offset, for current date, modified in case of daylight savings. This is the offset to add *to* UTC to get local time.
Implements TimeZone. |
|
Implements TimeZone. |
|
Returns the TimeZone's adjusted GMT offset (i.e. , the number of milliseconds to add to GMT to get local time in this time zone, taking daylight savings time into account) as of a particular reference date. The reference date is used to determine whether daylight savings time is in effect and needs to be figured into the offset that is returned (in other words, what is the adjusted GMT offset in this time zone at this particular date and time?). For the time zones produced by createTimeZone(), the reference data is specified according to the Gregorian calendar, and the date and time fields are in GMT, NOT local time.
Implements TimeZone. |
|
Returns the TimeZone's raw GMT offset (i.e. , the number of milliseconds to add to GMT to get local time, before taking daylight savings time into account).
Implements TimeZone. |
|
Return the class ID for this class. This is useful only for comparing to a return value from getDynamicClassID(). For example: . Base* polymorphic_pointer = createPolymorphicObject(); . if (polymorphic_pointer->getDynamicClassID() == . Derived::getStaticClassID()) ...
Reimplemented from TimeZone. |
|
Return true if this zone has the same rules and offset as another zone.
Reimplemented from TimeZone. |
|
Returns true if the given date is within the period when daylight savings time is in effect; false otherwise. If the TimeZone doesn't observe daylight savings time, this functions always returns false.
Implements TimeZone. |
|
Returns true if the two TimeZone objects are equal; that is, they have the same ID, raw GMT offset, and DST rules.
Reimplemented from TimeZone. |
|
Sets the amount of time in ms that the clock is advanced during DST.
|
|
Sets the DST end rule to a weekday before or after a give date within a month, e.g. , the first Monday on or after the 8th.
|
|
Sets the DST end rule to a fixed date within a month.
|
|
Sets the daylight savings ending rule. For example, in the U.S., Daylight Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. Therefore, you can set the end rule by calling: . setEndRule(TimeFields.OCTOBER, -1, TimeFields.SUNDAY, 2*60*60*1000);Various other types of rules can be specified by manipulating the dayOfWeek and dayOfWeekInMonth parameters. For complete details, see the documentation for setStartRule().
|
|
Sets the TimeZone's raw GMT offset (i.e. , the number of milliseconds to add to GMT to get local time, before taking daylight savings time into account).
Implements TimeZone. |
|
Sets the DST start rule to a weekday before or after a give date within a month, e.g. , the first Monday on or after the 8th.
|
|
Sets the DST start rule to a fixed date within a month.
|
|
Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings Time starts at the first Sunday in April, at 2 AM in standard time. Therefore, you can set the start rule by calling: setStartRule(TimeFields.APRIL, 1, TimeFields.SUNDAY, 2*60*60*1000); The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate the exact starting date. Their exact meaning depend on their respective signs, allowing various types of rules to be constructed, as follows:
|
|
Sets the daylight savings starting year, that is, the year this time zone began observing its specified daylight savings time rules. The time zone is considered not to observe daylight savings time prior to that year; SimpleTimeZone doesn't support historical daylight-savings-time rules.
|
|
Queries if this TimeZone uses Daylight Savings Time.
Implements TimeZone. |