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 void AddRuleL ( TTzRule )
IMPORT_C CTzRules * CloneL ()
IMPORT_C TInt ConvertTime ( CVTzActualisedRules &, TTime &, TTzTimeReference )
IMPORT_C void ConvertToLocalL ( TTime &)
IMPORT_C void ConvertToUtcL ( TTime &)
IMPORT_C void CopyL (const CTzRules &)
IMPORT_C TInt Count ()
IMPORT_C TInt EndYear ()
IMPORT_C void ExternalizeL ( RWriteStream &)
IMPORT_C void GetActualisedRulesL ( CVTzActualisedRules &)
IMPORT_C TInt GetOffsetL (const TTime &, TTzTimeReference )
IMPORT_C TInt InitialStdTimeOffset ()
IMPORT_C void InternalizeL ( RReadStream &)
IMPORT_C TBool IsEqualTo (const CTzRules &)
IMPORT_C CTzRules * NewL ()
IMPORT_C CTzRules * NewL ( TInt , TInt )
IMPORT_C CTzRules * NewL ( RReadStream &)
IMPORT_C void RemoveRule ( TInt )
IMPORT_C TBool RulesApply (const TTime &)
IMPORT_C void SetEndYear ( TInt )
IMPORT_C void SetInitialStdTimeOffset ( TInt )
IMPORT_C void SetStartYear ( TInt )
IMPORT_C TInt SizeOfObject ()
IMPORT_C TInt StartYear ()
IMPORT_C TTzRule & operator[] ( TInt )
Private Member Functions
CTzRules ()
CTzRules ( TInt , TInt )
void AddActualisedRulesL ( 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 ( TInt aStartYear,
TInt aEndYear
) [private]

Parameters

TInt aStartYear
TInt aEndYear

~CTzRules()

IMPORT_C ~CTzRules ( )

Destructor.

Member Functions Documentation

AddActualisedRulesL(CVTzActualisedRules &, TInt)

void AddActualisedRulesL ( CVTzActualisedRules & aActRules,
TInt aYear
) 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 void AddRuleL ( TTzRule aRule )

Adds a time zone rule to this set.

Parameters

TTzRule aRule The 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 ( TTime aTimeA,
TTzTimeReference aTimeARef,
TTime aTimeB,
TTzTimeReference aTimeBRef,
TInt aStdOffset,
TInt aWallOffset,
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 TInt ConvertTime ( CVTzActualisedRules & aRules,
TTime & aTime,
TTzTimeReference aTimerRef
) const

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

Parameters

CVTzActualisedRules & aRules The actualised rules to use.
TTime & aTime The 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 aTimerRef What aTime is expressed in.

ConvertToLocalL(TTime &)

IMPORT_C void ConvertToLocalL ( TTime & aUtcTime ) const

Converts the received UTC time to local time.

Parameters

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

ConvertToUtcL(TTime &)

IMPORT_C void ConvertToUtcL ( TTime & aLocalTime ) const

Converts the received local time to UTC time.

Parameters

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

CopyL(const CTzRules &)

IMPORT_C void CopyL ( const CTzRules & aTzRule )

Copy a time zone rule to this time zone rule.

capability
None

Parameters

const CTzRules & aTzRule A rule to copy from.

Count()

IMPORT_C TInt Count ( ) const

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

EndYear()

IMPORT_C TInt EndYear ( ) const

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

ExternalizeL(RWriteStream &)

IMPORT_C void ExternalizeL ( RWriteStream & aStream ) const

Externalises time zone rules to a write stream.

leave
KErrArgument if the output stream size is invalid

Parameters

RWriteStream & aStream Stream to which the object should be externalised.

GetActualisedRulesL(CVTzActualisedRules &)

IMPORT_C void GetActualisedRulesL ( CVTzActualisedRules & aActRules ) const

Get actualised rules for time zone rules.

Parameters

CVTzActualisedRules & aActRules Actualised rules for time zone rules.

GetOffsetL(const TTime &, TTzTimeReference)

IMPORT_C TInt GetOffsetL ( const TTime & aTime,
TTzTimeReference aTimeRef
) const

Calculate the local time offset at the supplied time.

Parameters

const TTime & aTime
TTzTimeReference aTimeRef

InitialStdTimeOffset()

IMPORT_C TInt InitialStdTimeOffset ( ) const

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

InternalizeL(RReadStream &)

IMPORT_C void InternalizeL ( RReadStream & aStream )

Internalizes time zone rules from a read stream.

Parameters

RReadStream & aStream Stream from which the object should be internalised.

IsEqualTo(const CTzRules &)

IMPORT_C TBool IsEqualTo ( const CTzRules & aRules ) const

Compares two sets of timezone rules.

capability
None

Parameters

const CTzRules & aRules The 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 ( TInt aStartYear,
TInt aEndYear
) [static]

Creates a new time zone rules object.

Parameters

TInt aStartYear The first year in which these time zone rules apply.
TInt aEndYear The 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 & aStream Stream with the time zone rules to be used to create a CTzRules object.

RemoveRule(TInt)

IMPORT_C void RemoveRule ( TInt aIndex )

Removes a time zone rule from this set.

Parameters

TInt aIndex The index of the rule to be removed.

RulesApply(const TTime &)

IMPORT_C TBool RulesApply ( const TTime & aTime ) const

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

Parameters

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

SetEndYear(TInt)

IMPORT_C void SetEndYear ( TInt aYear )

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

Parameters

TInt aYear The year.

SetInitialStdTimeOffset(TInt)

IMPORT_C void SetInitialStdTimeOffset ( TInt aOffset )

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

Parameters

TInt aOffset The offset in minutes.

SetStartYear(TInt)

IMPORT_C void SetStartYear ( TInt aYear )

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

Parameters

TInt aYear The year.

SizeOfObject()

IMPORT_C TInt SizeOfObject ( ) const

Get the object size when it is internalize and externalised.

StartYear()

IMPORT_C TInt StartYear ( ) const

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

operator[](TInt)

IMPORT_C TTzRule & operator[] ( TInt aIndex )

Gets a time zone rule from this set.

Parameters

TInt aIndex The 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]