This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

J2ME accurate current time

 
Rácz György
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gurus!

Sorry for my bad english, im still learn it.
I have a big probleam. My J2ME application receive files from bluetooth connection, and i need to know the current time when the datas received. I tried many way to get accurate current time, but im always get inaccurate time (2hrs before the actual time). I checked my system time, and i set and use my location TimeZone settings etc. I use winXP and NetBeans 6.7.1 This is my test code:



When i running this code i received this:

cal1: Mon Sep 07 07:25:00 UTC 2009
cal2: 1252308300917
sBuf: 9/7/2009 8:25:0

The accurate current time is : 9:35...

In Eclipse ive got:

cal1: Mon Sep 07 09:36:07 CEST 2009
cal2: 1252308967467
sBuf: 9/7/2009 8:36:7

This code (cal1) is work fine in Eclipse J2SE...

Please help me! Thanks!

George
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't CEST 2 hours before UTC? If you'll notice, the timezones printed are not the same. Java does tend to want to work with UTC, since that provides a common base, no matter where in the world you are.

In an actual device, the time would normally be set by an incoming signal from the carrier. I don't know specifically about systems in your area, or for that matter, even the one I use, but on land-line phones with called name/number delivery (Caller ID), there's a timestamp in the ASCII ID code that comes after the first ring of an incoming call. For mobiles, for all I know, they may pick up the time as part of the process where they seek out and identify their location to the carried. Then again, some phones have GPS, which means that they could get the atomic-precision time from the GPS satellite system.

So, in summary, the time in a cellphone "should" be quite accurate, but I don't guarantee it.The main thing is to make sure you're aware of timezone conversion requirements.

And your English is just fine. The only thing you need to remember is that the word "I" is always capitalized, even though "you" and "we" are not. We're not big on logical!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic