Symbian3/SDK/Source/GUID-CD506806-FC59-547A-B5CD-03314DF847F7.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-CD506806-FC59-547A-B5CD-03314DF847F7" xml:lang="en"><title>Date And Time Handling Overview</title><shortdesc>Functions that manipulates date and time values. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-C9F67EE0-BDA3-43B7-A0D5-D68CEAE58E0E"><title>Architectural
relationships</title> <p>The system maintains two clocks: </p> <ul>
<li id="GUID-3C5A5819-E800-518A-A8D9-8B6BEB52F0D1"><p>a secure clock
that can only be set by kernel code or by an application that has
TCB capability. This is a clock that can be used by secure DRM applications. </p> </li>
<li id="GUID-44375F26-F8E9-54AA-9F20-E0B74C7F905D"><p>a non-secure
clock that can be set by applications that require no specific capability.
This is the clock that is used for user-visible time displays. </p> </li>
</ul> <p>The non-secure clock is implemented in terms of an offset
from the secure clock. </p> <p>Both the secure time and the non-secure
time can be set using the System Static Functions API, and specifically: </p> </section>
<section id="GUID-2F364328-2127-4225-98A8-8F706E4B7BC7"><title>Secure
time </title> <ul>
<li id="GUID-FF13C20D-505B-55B0-B95C-1D64AF9A81E6"><p> <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-914FC88A-2D71-321B-8501-C7B91D142586"><apiname>User::SetHomeTimeSecure(0</apiname></xref> </p> </li>
<li id="GUID-6163CCC9-0C88-50B0-895B-6D781D389C49"><p> <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-B25BB967-380B-3A40-AD1B-53775C3335D7"><apiname>User::SetUTCTimeSecure()</apiname></xref> </p> </li>
</ul> </section>
<section id="GUID-81367F49-79D7-45C9-91CD-1A327EB71DF7"><title>Non-secure
time </title><ul>
<li id="GUID-BA9D3823-219E-5C21-89A5-8239F97349A0"><p> <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-95B49BD6-AAD8-3AEB-88A2-DD7E934AFAB6"><apiname>User::SetHomeTime()</apiname></xref> </p> </li>
<li id="GUID-E9AAE71D-29CD-530E-8F3E-F4B3BA55854C"><p> <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-145F52E6-2A29-3FF1-8AD1-7009BE0074D7"><apiname>User::SetUTCTime()</apiname></xref> </p> </li>
</ul> <p>System locale settings, which affect date and time formatting,
are set through <xref href="GUID-53299759-C2DD-3ABC-A055-9AFE7C5081C6.dita"><apiname>TLocale</apiname></xref> in the Locale Settings
API. </p> </section>
<section id="GUID-6F1F1A03-5336-4246-8EF7-602172A8E91B"><title>Description</title> <p>The API has three key concepts: point in time, time utilities,
and time interval. </p> <p><b>Point in time</b> </p> <p>The point in time is a 64-bit integer
that represents time as the number of microseconds since midnight
on 1st January 0 AD, using a nominal Gregorian calendar. It can be
set to the current system time, can have arithmetic and comparison
operations performed on it, and can be converted into a string formatted
according to the locale and other options. </p> <p>The main point
in time interface is provided by <xref href="GUID-A2D3BA72-9B27-3BFF-950A-D7E3B2004821.dita"><apiname>TTime</apiname></xref>. A support
class <xref href="GUID-13A9DD2B-8ABC-3D62-B54E-4F5DD5B9228B.dita"><apiname>TDateTime</apiname></xref> is provided that allows time values
to be get and set in an easy-to-use format, such as year, month, day,
rather than as an integer. </p> <p>The time value in a <codeph>TTime</codeph> object can be set using either the secure time or the non-secure
time. </p> <p><b>Time utilities</b> </p> <p>The time utilities provides miscellaneous
time functions, for such things as checking for leap years. </p> <p>The time utilities interface is provided by <xref href="GUID-B81A50BE-2045-3040-A5DD-D5DE03B52FCC.dita"><apiname>Time</apiname></xref>. </p> <p><b>Time interval</b> </p> <p>The time interval represents a period
between two points in time. Time intervals can be added or subtracted,
either to or from each other or to or from points in time. </p> <p>The time interval interface is provided by a base class <xref href="GUID-A5F9B2F0-6FCF-336E-95C6-9CE3EDFE4FD1.dita"><apiname>TTimeIntervalBase</apiname></xref> and by a family of derived classes for
second, minute, hour, etc. intervals. A class outside this hierarchy, <xref href="GUID-B7D6F874-1ABD-3AC6-9329-19DC54C12F18.dita"><apiname>TTimeIntervalMicroSeconds</apiname></xref>, is provided for efficiency reasons
(it alone stores its value as a 64-bit number). </p> </section>
</conbody><related-links>
<link href="GUID-FF8F5D97-7D37-5F6B-84A3-C064E2FD53E0.dita">
<linktext>System Static Functions Overview</linktext></link>
<link href="GUID-92C032CF-9291-5970-9152-EFF47C9AE3B9.dita"><linktext>Locale
Settings Overview</linktext></link>
</related-links></concept>