• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

J2ME accurate current time

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic