×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Getting the current time is timezone dependent on S60 2nd Edition (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search
extkbeditor2 (Talk | contribs)
m
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:KnowledgeBase) - now using Template:ArticleMetaData)
Line 2: Line 2:
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
{{KnowledgeBase
+
{{ArticleMetaData
 
|id=KIJ000085
 
|id=KIJ000085
 
|platform=S60 2nd Edition  
 
|platform=S60 2nd Edition  
Line 10: Line 10:
 
|creationdate=
 
|creationdate=
 
|keywords=
 
|keywords=
 +
 +
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 +
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 +
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
 +
|author=[[User:Technical writer 1]]
 
}}
 
}}
  

Revision as of 13:59, 24 June 2011

Template:KBKI


Article Metadata
Tested with
Devices(s): Nokia 6600
Compatibility
Platform(s): S60 2nd Edition
S60 2nd Edition (initial release)
Article
Created: User:Technical writer 1 ()
Last edited: hamishwillee (24 Jun 2011)

Description

CLDC 1.0 specification requires the method System.currentTimeMillis() to return the time in UTC (GMT).

Because some earlier phone models supported only time zone UTC, MIDlet programmers did not always take the difference between UTC and local time into account. MIDlets did work correctly assuming that the returned value was in local time, without even checking time zone settings.

In the Nokia 6600 device such existing MIDlets might behave differently, using UTC instead of local time as expected in many use cases.

Solution

Use a Calendar object to get the local time.

Calendar calendar = Calendar.getInstance() ;  // uses default TimeZone
Calendar.setTime( new Date( System.currentTimeMillis()) ;

Note: The phone user can set the time zone as follows:

1. By turning the automatic time update on. This is a network service and is not supported in all networks.

2. By setting the time zone manually in the Clock application or under Settings / Date & Time.

MIDlet programmers should be aware that Java applications are just about the only application in the phone that uses the time zone. Thus, users might have incorrect time zone settings in their phone without being aware of it.

66 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×