CTzRules Class Reference

class CTzRules : public CBase

Encapsulates a collection of time zone rules, and includes the period covered by the rules and the standard time offset at the start of that period.

Inherits from

Public Member Functions
~CTzRules()
IMPORT_C voidAddRuleL(TTzRule)
IMPORT_C CTzRules *CloneL()
IMPORT_C TIntConvertTime(CVTzActualisedRules &, TTime &, TTzTimeReference)
IMPORT_C voidConvertToLocalL(TTime &)
IMPORT_C voidConvertToUtcL(TTime &)
IMPORT_C voidCopyL(const CTzRules &)
IMPORT_C TIntCount()
IMPORT_C TIntEndYear()
IMPORT_C voidExternalizeL(RWriteStream &)
IMPORT_C voidGetActualisedRulesL(CVTzActualisedRules &)
IMPORT_C TIntGetOffsetL(const TTime &, TTzTimeReference)
IMPORT_C TIntInitialStdTimeOffset()
IMPORT_C voidInternalizeL(RReadStream &)
IMPORT_C TBoolIsEqualTo(const CTzRules &)
IMPORT_C CTzRules *NewL()
IMPORT_C CTzRules *NewL(TInt, TInt)
IMPORT_C CTzRules *NewL(RReadStream &)
IMPORT_C voidRemoveRule(TInt)
IMPORT_C TBoolRulesApply(const TTime &)
IMPORT_C voidSetEndYear(TInt)
IMPORT_C voidSetInitialStdTimeOffset(TInt)
IMPORT_C voidSetStartYear(TInt)
IMPORT_C TIntSizeOfObject()
IMPORT_C TIntStartYear()
IMPORT_C TTzRule &operator[](TInt)
Private Member Functions
CTzRules()
CTzRules(TInt, TInt)
voidAddActualisedRulesL(CVTzActualisedRules &, TInt)
TInt CompareTimesWithRef(TTime, TTzTimeReference, TTime, TTzTimeReference, TInt, TInt, TTimeIntervalMinutes *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
CVTzActualisedRules *iActualisedRulesCache
TInt16 iEndYear
TInt iInitialStdTimeOffset
RArray< TTzRule >iRules
TInt16 iStartYear

Constructor & Destructor Documentation

CTzRules()

CTzRules()[private]

CTzRules(TInt, TInt)

CTzRules(TIntaStartYear,
TIntaEndYear
)[private]

Parameters

TInt aStartYear
TInt aEndYear

~CTzRules()

IMPORT_C~CTzRules()

Destructor.

Member Functions Documentation

AddActualisedRulesL(CVTzActualisedRules &, TInt)

voidAddActualisedRulesL(CVTzActualisedRules &aActRules,
TIntaYear
)const [private]

Based on the rules in the object calculates actualised rules for particular year and adds them to the specified array of actualised rules (CVTzActualisedRules).

Parameters

CVTzActualisedRules & aActRules- an array of actualised rules where new actualised rules are added;
TInt aYear- a year for which actualised rules are added.

AddRuleL(TTzRule)

IMPORT_C voidAddRuleL(TTzRuleaRule)

Adds a time zone rule to this set.

Parameters

TTzRule aRuleThe rule to be added.

CloneL()

IMPORT_C CTzRules *CloneL()const

Creates a copy of these timezone rules.

capability
None

CompareTimesWithRef(TTime, TTzTimeReference, TTime, TTzTimeReference, TInt, TInt, TTimeIntervalMinutes *)

TInt CompareTimesWithRef(TTimeaTimeA,
TTzTimeReferenceaTimeARef,
TTimeaTimeB,
TTzTimeReferenceaTimeBRef,
TIntaStdOffset,
TIntaWallOffset,
TTimeIntervalMinutes *aMinutesDifference
)const [private]

Compares two times with time references (TTzTimeReference). TTzTimeReference is either UTC, or STD, or ETzWallTimeReference.

Comparison is done at some point in time when aStdOffset applies to item(s) with ETzStdTimeReference, and aWallOffset applies to item(s) with ETzWallTimeReference.

If time references for both aTimeA and aTimeB are the same, then straight comparison is done to aTimeA and aTimeB. Otherwise, STD or wall-clock time is converted to UTC using either aStdOffset, or aWallOffset correspondingly.

Thus, aStdOffset parameter is never used if none of aTimeA and aTimeB is ETzStdTimeReference; and, similarly, aWallOffset is never used if none of aTimeA and aTimeB is ETzWallTimeReference.

Parameters

TTime aTimeA- first time with reference;
TTzTimeReference aTimeARef
TTime aTimeB- second time with reference, to compare to aTimeA;
TTzTimeReference aTimeBRef
TInt aStdOffset- an offset (in minutes) to be used for a time with ETzStdTimeReference;
TInt aWallOffset- an offset (in minutes) to be used for a time with ETzWallTimeReference;
TTimeIntervalMinutes * aMinutesDifference-on return, the time difference between aTimeA and aTimeB in minutes;

ConvertTime(CVTzActualisedRules &, TTime &, TTzTimeReference)

IMPORT_C TIntConvertTime(CVTzActualisedRules &aRules,
TTime &aTime,
TTzTimeReferenceaTimerRef
)const

Converts between local (wall-clock) and UTC times.

Parameters

CVTzActualisedRules & aRulesThe actualised rules to use.
TTime & aTimeThe time to convert, specified by aTimerRef if the time is in UTC or local time. On return, it will contain the converted time from UTC to local time or vice versa, depending on aTimerRef's value.
TTzTimeReference aTimerRefWhat aTime is expressed in.

ConvertToLocalL(TTime &)

IMPORT_C voidConvertToLocalL(TTime &aUtcTime)const

Converts the received UTC time to local time.

Parameters

TTime & aUtcTimeThe time to convert. On return, this contains the converted time.

ConvertToUtcL(TTime &)

IMPORT_C voidConvertToUtcL(TTime &aLocalTime)const

Converts the received local time to UTC time.

Parameters

TTime & aLocalTimeThe time to convert. On return, this contains the converted time.

CopyL(const CTzRules &)

IMPORT_C voidCopyL(const CTzRules &aTzRule)

Copy a time zone rule to this time zone rule.

capability
None

Parameters

const CTzRules & aTzRuleA rule to copy from.

Count()

IMPORT_C TIntCount()const

Gets the number of time zone rules (TTzRules) in this set.

EndYear()

IMPORT_C TIntEndYear()const

Gets the last year in which the time zone rules apply.

ExternalizeL(RWriteStream &)

IMPORT_C voidExternalizeL(RWriteStream &aStream)const

Externalises time zone rules to a write stream.

leave
KErrArgument if the output stream size is invalid

Parameters

RWriteStream & aStreamStream to which the object should be externalised.

GetActualisedRulesL(CVTzActualisedRules &)

IMPORT_C voidGetActualisedRulesL(CVTzActualisedRules &aActRules)const

Get actualised rules for time zone rules.

Parameters

CVTzActualisedRules & aActRulesActualised rules for time zone rules.

GetOffsetL(const TTime &, TTzTimeReference)

IMPORT_C TIntGetOffsetL(const TTime &aTime,
TTzTimeReferenceaTimeRef
)const

Calculate the local time offset at the supplied time.

Parameters

const TTime & aTime
TTzTimeReference aTimeRef

InitialStdTimeOffset()

IMPORT_C TIntInitialStdTimeOffset()const

Gets the initial UTC offset for this set of time zone rules.

InternalizeL(RReadStream &)

IMPORT_C voidInternalizeL(RReadStream &aStream)

Internalizes time zone rules from a read stream.

Parameters

RReadStream & aStreamStream from which the object should be internalised.

IsEqualTo(const CTzRules &)

IMPORT_C TBoolIsEqualTo(const CTzRules &aRules)const

Compares two sets of timezone rules.

capability
None

Parameters

const CTzRules & aRulesThe timezone rules to compare with.

NewL()

IMPORT_C CTzRules *NewL()[static]

Creates a new time zone rules object.

NewL(TInt, TInt)

IMPORT_C CTzRules *NewL(TIntaStartYear,
TIntaEndYear
)[static]

Creates a new time zone rules object.

Parameters

TInt aStartYearThe first year in which these time zone rules apply.
TInt aEndYearThe last year in which these time zone rules apply.

NewL(RReadStream &)

IMPORT_C CTzRules *NewL(RReadStream &aStream)[static]

Creates a new time zone rules object from a stream.

Parameters

RReadStream & aStreamStream with the time zone rules to be used to create a CTzRules object.

RemoveRule(TInt)

IMPORT_C voidRemoveRule(TIntaIndex)

Removes a time zone rule from this set.

Parameters

TInt aIndexThe index of the rule to be removed.

RulesApply(const TTime &)

IMPORT_C TBoolRulesApply(const TTime &aTime)const

Queries the time zone rule set to see if they apply to a specified time.

Parameters

const TTime & aTimeThe time to be checked, using the same time reference used when constructing CTzRules.

SetEndYear(TInt)

IMPORT_C voidSetEndYear(TIntaYear)

Sets the last year in which the time zone rules apply.

Parameters

TInt aYearThe year.

SetInitialStdTimeOffset(TInt)

IMPORT_C voidSetInitialStdTimeOffset(TIntaOffset)

Sets the initial UTC offset for this set of time zone rules.

Parameters

TInt aOffsetThe offset in minutes.

SetStartYear(TInt)

IMPORT_C voidSetStartYear(TIntaYear)

Sets the first year in which the time zone rules apply.

Parameters

TInt aYearThe year.

SizeOfObject()

IMPORT_C TIntSizeOfObject()const

Get the object size when it is internalize and externalised.

StartYear()

IMPORT_C TIntStartYear()const

Gets the first year in which the time zone rules apply.

operator[](TInt)

IMPORT_C TTzRule &operator[](TIntaIndex)

Gets a time zone rule from this set.

Parameters

TInt aIndexThe index of the rule to be fetched.

Member Data Documentation

CVTzActualisedRules * iActualisedRulesCache

CVTzActualisedRules *iActualisedRulesCache[private]

TInt16 iEndYear

TInt16 iEndYear[private]

TInt iInitialStdTimeOffset

TInt iInitialStdTimeOffset[private]

RArray< TTzRule > iRules

RArray< TTzRule >iRules[private]

TInt16 iStartYear

TInt16 iStartYear[private]