1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Defines TTsTime class, to represent UTC and Local Time for use within Task Scheduler
25 //Forward declarations
30 In Task Scheduler TTsTime is used to represent time as either UTC or Local Time.
31 It is used by many of the Task Scheduler API's and also used internally within Task Scheduler.
32 This class is not expected to be stored by Task Scheduler clients.
34 It provides EXPORTed APIs for constructing, setting and getting UTC and Local Time.
36 Internally the object always holds time as UTC (using the data member iUTC) irrespective of
37 whether the object is local time based or UTC based.
39 If the object is local time based iOffset will be set to the system TimeZone/DST offset.
40 When UTC based iOffset will always be 0.
44 When representing UTC:
45 iUTC contains the UTC time
47 iFlags, bit 0 is set to 1
49 When representing Local Time:
50 iUTC contains the home time minus the TimeZone/DST offset
51 iOffSet contains the TimeZone/DST offset
52 iFlags, bit 0 is set to 0
54 If an instance of this class is created using the default constructor then:
57 iFlags, bit 0 is set to 1 (indicating UTC time)
68 IMPORT_C TTsTime(const TTime& aTime, TBool aIsUtc);
70 IMPORT_C void SetLocalTime(const TTime& aLocalTime);
72 IMPORT_C const TTime GetLocalTime();
74 IMPORT_C TTime GetLocalTime() const;
76 IMPORT_C void SetUtcTime(const TTime& aUtcTime);
78 IMPORT_C const TTime& GetUtcTime();
80 IMPORT_C const TTime& GetUtcTime() const;
82 IMPORT_C TBool IsUtc() const;
84 IMPORT_C TTsTime& operator=(const TTsTime& aTsTime);
86 IMPORT_C TTsTime(const TTsTime& aTTsTime);
89 // APIs for use within the Task Scheduler server
91 void ExternalizeL(RWriteStream& aStream) const;
93 void InternalizeL(RReadStream& aStream);
95 void ProcessOffsetEvent();
97 inline TTimeIntervalSeconds GetOffset();
103 TTime DetermineLocalTime() const;
106 This object always stores time as UTC irrespective of whether the object is home time or UTC based.
111 If the object is UTC based then this will always be 0. If home time based then this will contain the value
112 of system TimeZone/DST offset at the time that the object was created or last updated.
114 TTimeIntervalSeconds iOffset;
117 Bit 0 is set to 0 when UTC based, Bit 0 is set to 1 when home time based, Bit1-Bit31 are reserved for future use.
124 This method must only be used by Task Scheduler itself as it returns raw offset data
125 that can become out of date if system Timezone/DST changes occur.
128 // Not for Client Use , Only to be used Internally.
129 inline TTimeIntervalSeconds TTsTime::GetOffset()