Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Why are modern devices so terrible at accurate timekeeping?
6 points by Last5Digits 10 months ago | hide | past | favorite | 13 comments
When I check the clock on my phone or laptop against my radio alarm or time.is, I usually see a time drift between a second or two. Now, this isn't really a problem when it comes to simply knowing the approximate time, but it gives me massive headaches when it comes to file syncing.

I have a server to which I constantly synchronize all of my important files as a read-only backup. Now, the issue is that when I make a change on device A, sync it to device B, make another change there, and then sync it to my server - then there is a reasonable chance that the timestamps of the two changes will either overlap or be in reverse order! This will, obviously, lead to data loss.

What boggles my mind is how easy this would be to fix! Windows already uses NTP to sync the system clock, but it seems to do this so rarely as to regularly accrue seconds of time drift. Why? NTP sync requires negligible amounts of system resources.

Even worse is my phone. It can obviously receive GPS signals for geolocation, and therefore has access to the most accurate time signal available. But it doesn't even use it! When my phone is disconnected from any network, it will simply get less and less accurate while throwing away a constant stream of atomic timestamps from the GPS antenna. And while it is connected to the network, it suffers from the same weird reluctance to sync itself to time servers as often as possible.

Genuinely, am I missing something? My old 30$ Casio radio watch has more accurate time than all the very much more sophisticated and expensive tech around me. Why?




Quartz oscillators are sensitive to temperature. Modern computing involves varying power frequently, and therefore heat and temperature, so the real time clock varies a lot; even if we assume it sometimes gets calibrated / disciplined.

I think most phones sync to the cellular network time, when available. GPS would allow for an alternate time source, but it's not always enabled and maybe nobody thought to feed it into the time source while the network isn't available.

On Windows, I think the default settings for time sync are amazingly low; probably Microsoft didn't want to foot the bill, as they do run the servers windows syncs from, it's a large population, so increasing the sync volume would probably be meaningful. Microsoft also used to run a time server in Washington state somewhere with really bad asymmetric delay, leading to pretty poor sync performance. But it looks ok now.


Modern computers (including mobile SoCs) don't typically use quartz oscillators any longer. Instead, they use MEMS (microelectromechanical system) oscillators, at least some of which can automatically compensate for temperature variations.


I experience time drift with devices not connected to NTP like cheap stopwatch/microwave clock/etc, but my all my devices connected to NTP stay synced on their own.

For example:

- Windows time settings says: "Last successful time synchronization: 3/7/2024..." (This was ~41 hours ago and not manually triggered.)

- https://time.is/: "Your clock is 0.4 seconds ahead."

I'm a little surprised there is a 0.4 second difference, but it doesn't seem to affect syncing via Dropbox/Google files.

Perhaps the answer is that time that is accurate to within a second or so of precision is good enough for most consumers.


Have you explicitly told your phone etc to ignore sync or to use network time? My consumer stuff all works fine (Android and macOS), so I don't that think your sweeping claim in the headline is true. You may have simply gave a few troublesome devices with bugs or inappropriate settings/overrides.

(Yes, I care - I have run NTP servers including some of the first in banking - since long before it was fashionable, and some of my code is probably still in ntpd.)


While I apologize for making general claims without a significantly larger sample size, I have tried this on all of my devices and those of family and friends. I only have access to phones running Android and laptops/desktops running Windows, so I cannot say whether macOS/iOS and Linux suffer from the same issue. I'm looking at ~12 devices from various manufacturers that all have similar amounts of clock drift.

All of the devices have network sync enabled, and they sync to accurate time if I manually disable and enable it again. The issue is that they don't sync regularly enough by themselves.


This sounds more like a syncing strategy issue. Maybe you just need to schedule delays into the sync. Or more likely, stop peer syncing. Instead of syncing from A to B then B to server, sync A to sever then server to B. A master sync strategy that uses the time on master is probably better then peer syncing strategies if you're having issues with time keeping between systems.


I mean sure, I could solve the issue with a better strategy, but what bugs me is that this is a problem in the first place. Should accurate time really still be an issue in 2024?


In theory it shouldn't be. In practice, for the vast majority of people, it isn't. If one needs precise time, there are ways to do it. Most things don't need it that precisely. If the sync function requires precise time, then it should schedule syncs, or even use network time rather than system time (it needs a network to sync anyways).

Basically, if it's not an issue people have no incentive to fix it. For the vast majority of people, this is not an issue.


This doesn't agree with my experience. If the time were consistently off by multiple seconds then the sweep second hand on my apple watch would stutter whenever the time was re-synchronized, but it does not.


I only have access to Android devices, so my claim likely won't extend to Apple. In fact, I've been told by a friend that Apple watches do in fact use the GPS signal to sync the clock. But as far as I know, they are the only ones doing that.


A brief google search find this information on maintaining time accuracy on Windows. https://learn.microsoft.com/en-us/troubleshoot/windows-serve...

In general though, you need to look in more detail at what your exact configuration is and find out what you have misconfigured.


I never made the claim that there were no solutions to the problems outlined above. In fact, I implemented exactly what you've linked long ago. This doesn't, of course, change the fact that no such easy procedure exists on unrooted Android devices and that Windows, by default, has inaccurate timekeeping. Requiring extensive configuration for something as simple as accurate time is what irks me. Time sync is neither expensive nor complicated, so why is Windows so reluctant to do it often enough to keep the time?

Having to set registry values to get sane syncing behavior is just nuts when, again, my cheap Casio watch - which possesses a miniscule fraction of the features of a modern computing device - can deliver sub 500ms accuracy with absolutely zero fuss.


Big picture - decades of cheaper-is-always-better design and BoM optimizations, and the perception that nobody cares about second-scale accuracy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: