tzservices/tzserver/Client/Source/timezonerules.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2004-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 #include <tz.h>
       
    17 #include "tzrules.h"
       
    18 #include <tzdefines.h>
       
    19 
       
    20 //
       
    21 /**
       
    22 Serialised TTzActualisedRule externaliser.
       
    23 @param aStream A stream that will contain the serialised TTzActualisedRule.
       
    24 */
       
    25 EXPORT_C void TTzActualisedRule::ExternalizeL(RWriteStream& aStream) const
       
    26 	{
       
    27 
       
    28 	TInt64 time = iTimeOfChange.Int64();
       
    29 	aStream << time;
       
    30 
       
    31 	aStream << iStdOffset;
       
    32 	aStream << iDstOffset;
       
    33 	aStream.WriteInt32L(iTimeReference);
       
    34 	}
       
    35 
       
    36 /**
       
    37 Serialised TTzActualisedRule data internaliser.
       
    38 @param aStream A stream containing the serialised TTzActualisedRule.
       
    39 */
       
    40 EXPORT_C void TTzActualisedRule::InternalizeL(RReadStream& aStream)
       
    41 	{
       
    42 	TInt64 time;
       
    43 
       
    44 	aStream >> time;
       
    45 	iTimeOfChange = TTime(time);
       
    46 
       
    47 	aStream >> iStdOffset;
       
    48 	aStream >> iDstOffset;
       
    49 	iTimeReference = static_cast<TTzTimeReference>(aStream.ReadInt32L()); 
       
    50 	}
       
    51 
       
    52 // comparator used by the RArray<TTzActualisedRule>
       
    53 TInt TTzActualisedRule::Order(const TTzActualisedRule& aLeft, const TTzActualisedRule& aRight)
       
    54 	{
       
    55 
       
    56 	if (aLeft.iTimeOfChange < aRight.iTimeOfChange)
       
    57 		{
       
    58 		return -1;
       
    59 		}
       
    60 	if (aLeft.iTimeOfChange == aRight.iTimeOfChange)
       
    61 		{
       
    62 		return 0;
       
    63 		}
       
    64 	return 1;
       
    65 	}
       
    66