equal
deleted
inserted
replaced
|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <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; |
|
13 User::LeaveIfError(iMobilePhone.GetNITZInfo(NITZInfo)); |
|
14 TInt day = -1; |
|
15 |
|
16 if (NITZInfo.iNitzFieldsUsed & RMobilePhone::KCapsTimeAvailable) |
|
17 { |
|
18 day = NITZInfo.Day(); |
|
19 } |
|
20 </codeblock> </example> </taskbody></task> |