Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

J2ME accurate current time  RSS feed

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!

Posts: 19217
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!
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!