Friday, September 30, 2011

[android-developers] Re: How to get pure UTC time?

I also have a need for accurate NTP embedded into my app. I am
writing a very accurate musical instrument tuner. One of the things
that such an app needs to do is to calibrate the device to compensate
for variations in the sound system's quartz crystal time base. On
another platform I did this by having the user call up the NIST's free
time and frequency standard service on a wired phone and let my app
listen to the 500 Hz or 600 Hz reference tones. But that is a pain
for the user. I would like to offer a alternative NTP method of doing
this for devices that have occasional broadband internet connection..
My idea is to sample NTP time at the same time that I start counting
audio packets coming in from the sound API. Then after some time
(maybe 10 minutes) sample NTP again. By knowing the difference in NTP
time and the number of audio packets processed I can find the
necessary calibration for that device. The accuracy I am looking for
is 1 part in 200,000. For a 10-minute sample interval that translates
to a total time accuracy of 3 msec. If that is difficult to do with
NTP then I could extend my sample time to 100 minutes. Then I would
only need 30 msec. time accuracy. But the longer I make the sample
period the more of a pain it becomes for the user, even if he only has
to do this once when the app is first installed. Can anyone tell me
if embedding NTP into my app is likely to serve this purpose?

On Sep 30, 2:48 pm, Jim Graham <> wrote:
> On Wed, Sep 28, 2011 at 11:52:18AM -0700, cool_zack wrote:
> > I want to get UTC time. It should not change except for tiny
> > adjustments that happen from Network. User modifications to the time
> > on the device must not affect it.
> What you're asking for is SNTP (often abbreviated as NTP).  If all you
> need is an app, search in the market for NTP.  Most of the NTP apps
> will set your device's clock (requires root).
> There's an app, called "UTC Time" which displays local time and UTC
> side by side.  With a rooted device, it will also keep your device's
> time set to whichever SNTP server you have it configured for.
> If you need this for an app you're writing, let me know what you find,
> as I have some ideas along that line, myself......
> Later,
>    --jim
> --
> THE SCORE:  ME:  2  CANCER:  0
> 73 DE N5IAL (/4)        | Remember your spelling rules, including:
>    |   I before E except after C
> < Running FreeBSD 7.0 > |
> ICBM / Hurricane:       |   BEING a native-born American, I don't
>    30.44406N 86.59909W  |   always notice our WEIRD spelling....
> Android Apps Listing at

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment