Hacker News new | comments | show | ask | jobs | submit login

In the age of mobile phones that can get the time directly from GPS satellites with sub-100ns accuracy, the isolated hardware clock of a typical server strikes me as an arcane method of keeping time.

Is there an expansion card or USB device that can get the time from GPS and feed it to something like ntpd (and adjust for leap seconds from data downloded from other networks)? Or would that be impractical because of all the walls and metal cages that surround the typical server? What about an antenna on the roof of the datacenter that supplies GPS time to every server in the building?

Datacenter GPS-backed time sources exist. You can get little boxes which sit in a rack and hook to an antenna and feed nice time to the rest of the place. Those other machines pick it up with ntpd.

The problem is when your system clock is so far out of whack (and/or unpredictable) that even ntpd won't help you. Get enough supposedly-identical machines running and this will probably bite you too.

This is 100% true. If you have ever watched ntpd ignore a stratum 0 clock (and every other time source) because some stratum 6 device reports the wrong time, you know the pain. Yes, this isn't supposed to happen, and yes it has happened to me many times.

well, you can override ntpd to always sync no matter how far out of whack but it's not recommended

tinker panic 0

While most smartphones, theoretically, could get their time from GPS... do any use this method? As far as I know, my Android handsets get their time via NTP.

Ironically, often a misconfigured NTP server screws up GPS fixes (it somehow seems to be necessary for assisted GPS, which relies on the cooperation of the mobile network or Internet to faster acquire a GPS fix).


I think cell phones get their time from the tower, since they have to sync clocks with the tower to talk to it anyway, and the towers get time from GPS.

>In the age of mobile phones that can get the time directly from GPS satellites with sub-100ns accuracy, the isolated hardware clock of a typical server strikes me as an arcane method of keeping time.

Genuinely curious, is it actually true that you can get sub-100ns time accuracy on a mobile phone? Is this because you have a direct connection with the satellite, which is calculating where you are? I would have assumed that the uncertainty on the latency of any such connection would be higher than 100 ns.

GPS satellites don't do any calculating for you, and there is no "direct connection" between the satellite and your phone. The GPS receiver in your phone is purely passive. It uses latency (usually a few dozen milliseconds) to calculate its distance from each satellite.

As long as you have access to at least 4 satellites, triangulation (quadri-angulation?) allows you to determine your precise location in all 4 dimensions, three of space and one of time.

From https://en.wikipedia.org/wiki/GPS#Timekeeping :

GPS time is theoretically accurate to about 14 nanoseconds. However, most receivers lose accuracy in the interpretation of the signals and are only accurate to 100 nanoseconds.

For phones to achieve that the GPS would have to be turned on & synced near constantly. Also the accuracy goes down with mobile devices and new strategies have to be applied given the change in altitude and greater temperature flux. It also depends on the phone's internall oscillator & the gps recv unit used.

Mobile phones use CDMA stuff to sync their clocks, not GPS

GSM phones are supposed to be able to pick up "NITZ" (network information and time zone") messages, but these aren't reliably sent by most networks. In practice, smartphones get it over NTP like everyone else and dumbphones have user-set time that may, if you're lucky, be synced by counting the base station's time slot intervals.

Yes modern smartphones often hardcode ntp servers and prob do ineffective hard resetting. Would be good to know more how they do it.

Things have changed a bit since the last time I had anything to with it, but you can read the Android source code: https://github.com/android/platform_frameworks_base/blob/mas...

NITZ is terrible. You only get one-second accuracy, a GMT offset, and a DST flag, and they can all be wrong at the whim of someone at the phone company.

Yeah, GPS doesn't really work indoors. You can certainly get such devices, or even do it with consumer GPS, but then you have to account for the latency of USB.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact