tzservices/tzserver/Client/Include/tzrules.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __TIMEZONERULES_H__
       
    17 #define __TIMEZONERULES_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <s32std.h>
       
    21 #include <tzdefines.h>
       
    22 #include "tzpersisted.h"
       
    23 
       
    24 const TInt KActualisedRulesGranularity = 8;
       
    25 
       
    26 // specifies the limits for rules caching.
       
    27 // (year - KRuleCacheLowerLimit) , (year + KRuleCacheUpperLimit)
       
    28 // the actual cache includes one more year at year - (KRuleCacheLowerLimit + 1)
       
    29 // required to provide the offset used at the start of the search 
       
    30 const TUint KRuleCacheLowerLimit = 2;
       
    31 const TUint KRuleCacheUpperLimit = 3;
       
    32 
       
    33 /**
       
    34 Encapsulates a single Time Zone DST Rule
       
    35 
       
    36 @internalComponent
       
    37 @since 9.1
       
    38 */
       
    39 class TTzActualisedRule
       
    40 	{
       
    41 public:	
       
    42 	inline TTzActualisedRule(const TTime& aTimeOfChange, TInt  aStdOffset, TInt aDstOffset, TTzTimeReference aTimeReference);
       
    43 	inline TTzActualisedRule();
       
    44 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
    45 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
    46 
       
    47 	static TInt Order(const TTzActualisedRule& aLeft, const TTzActualisedRule& aRight);
       
    48 
       
    49 public:
       
    50 	/** time of DST change w.r.t to iTimeReference
       
    51 	*/
       
    52 	TTime iTimeOfChange;
       
    53 	/** std to UTC offset
       
    54 	*/
       
    55 	TInt32  iStdOffset;
       
    56 
       
    57 	/** wall-clock to standard time offset
       
    58 	*/
       
    59 	TInt32 iDstOffset;
       
    60 				
       
    61 	/** what time recogning iTimeOfChange is referenced to; see <code> TTzTimeReference </code> 
       
    62 	*/
       
    63 	TTzTimeReference iTimeReference;
       
    64 	};
       
    65 
       
    66 inline TTzActualisedRule::TTzActualisedRule(const TTime& aTimeOfChange, TInt  aStdOffset, TInt aDstOffset, TTzTimeReference aTimeReference) :
       
    67 					iTimeOfChange(aTimeOfChange),
       
    68 					iStdOffset(aStdOffset),
       
    69 					iDstOffset(aDstOffset),
       
    70 					iTimeReference(aTimeReference)
       
    71 	{
       
    72 	}
       
    73 
       
    74 inline TTzActualisedRule::TTzActualisedRule() :
       
    75 					iTimeOfChange(0),
       
    76 					iStdOffset(0),
       
    77 					iDstOffset(0),
       
    78 					iTimeReference(ETzUtcTimeReference)
       
    79 	{
       
    80 	}
       
    81 
       
    82 #endif
       
    83 
       
    84