Symbian3/PDK/Source/GUID-CC05C1AA-02B0-5E94-9522-44BCF44CBA48.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 11:42:04 +0100
changeset 4 4816d766a08a
parent 3 46218c8b8afa
child 5 f345bda72bc4
permissions -rw-r--r--
Week 12 contribution of SDK documentation_content. See release notes for details. Fixes Bug 1892, Bug 1522, Bug 1520, Bug 394, Bug 1319, Bug 344, Bug 1897

<?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 task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task xml:lang="en" id="GUID-CC05C1AA-02B0-5E94-9522-44BCF44CBA48"><title>Network Date and Time Tutorial</title><shortdesc>This tutorial describes how to retrieve the date and the time from the network. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-E86AF736-7707-56F3-8F73-61C17525F537"> <step id="GUID-0FBD2902-20AC-5396-9F01-00DD00D23127"><cmd>To get the network date and time settings, use <xref href="GUID-AA81AFA4-6FAC-3B0D-A082-BE0AEC58CCA8.dita"><apiname>RMobilePhone::GetNITZInfo()</apiname></xref>. </cmd> <info>This returns a <xref href="GUID-AA81AFA4-6FAC-3B0D-A082-BE0AEC58CCA8.dita"><apiname>RMobilePhone::TMobilePhoneNITZ</apiname></xref> object, derived from <xref href="GUID-AA81AFA4-6FAC-3B0D-A082-BE0AEC58CCA8.dita"><apiname>TDateTime</apiname></xref>. The <codeph>iNitzFieldsUsed</codeph> member, of type <xref href="GUID-AA81AFA4-6FAC-3B0D-A082-BE0AEC58CCA8.dita"><apiname>RMobilePhone::TMobilePhoneNITZCaps</apiname></xref>, describes what fields are available. </info> </step> <step id="GUID-3CEA4FE9-F2F3-5331-BF24-9A25B7FF8F6B"><cmd>To get the notification of any changes to the type of time information available, use <xref href="GUID-AA81AFA4-6FAC-3B0D-A082-BE0AEC58CCA8.dita"><apiname>RMobilePhone::NotifyNITZInfoChange()</apiname></xref>. </cmd> </step> </steps> <example><title>Date and time example</title> <p>The following code checks if time information is available, and if so, stores the day information in the variable <codeph>day</codeph>. </p> <p>The code assumes <codeph>iMobilePhone</codeph> is an <xref href="GUID-AA81AFA4-6FAC-3B0D-A082-BE0AEC58CCA8.dita"><apiname>RMobilePhone</apiname></xref> object. </p> <codeblock id="GUID-9000BE6E-B63A-5EA8-BB30-D9A629610E62" xml:space="preserve">RMobilePhone::TMobilePhoneNITZ NITZInfo;
User::LeaveIfError(iMobilePhone.GetNITZInfo(NITZInfo));
TInt day = -1;

if (NITZInfo.iNitzFieldsUsed &amp; RMobilePhone::KCapsTimeAvailable)
    {
     day = NITZInfo.Day();
    }
</codeblock> </example> </taskbody></task>