Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I know if the local computer clock is incorrect? I´m creating a system in which it is very important to know the right time.

Are there any good free time servers I can use, or is there any other way to know if the computer clock is incorrect?

share|improve this question
    
What OS? Most come built in with options for NTP servers. –  Simon Sheehan Aug 1 '11 at 1:50
    
Windows can do this without any additional software. Are you using Windows, and if so, what version? –  KCotreau Aug 1 '11 at 2:10
add comment

migrated from stackoverflow.com Aug 1 '11 at 1:09

This question came from our site for professional and enthusiast programmers.

4 Answers

You need an external time source in order to know if your is time off or not compared the the source.

The more sources you have, the more safe you can be. Usually, NTP is enough to keep the system time correct. If, however, you have no access to a network or to an NTP server, you can attach a radio controlled clock to the system, or use GPS for time synchronisation.

share|improve this answer
    
ntp will generally keep clocks in sync within a few thousandths of a second. Use three or five sources to allow voting to work well. There are several public pools, as will as a lot of public servers. Many countries provide open access time servers synced to their atomic clock. Normally I include my ISP's servers in my source pool. If they don't have separate time servers, an accurate source is often provided by the DNS servers. GPS or radio sources are available for disconnected servers. –  BillThor Aug 1 '11 at 4:40
add comment

there are lots of good free time servers, part of the NTP network. I don't know if Windows supports NTP, but any Unix system, including Mac OSX, ought to work with it.

http://www.pool.ntp.org/en/

share|improve this answer
1  
I use the Meinberg NTP client on my Windows machines: meinberg.de/english/sw/ntp.htm Obviously Linux and Mac already have this built in. –  Hydaral Aug 1 '11 at 2:00
3  
Windows has a built-in NTP client accessed simply by right-clicking your clock, selecting Adjust Date & Time, and going to the Internet Time tab. The in-built NTP client only supports one source, which is sufficient for typical purposes, but depending on your application you might want to use a multi-source client. –  jcrawfordor Aug 1 '11 at 2:19
1  
Windows has a built in NTP client. –  surfasb Aug 1 '11 at 10:23
add comment

You can use NTP software (or the built-in functionality depending on the OS) to update the time. If it supports custom servers, you can find plenty of them, including NIST's servers (they have their own atomic—caesium to be specific—clock and are the USA’s official time keeper). Even if the system clock isn’t perfect (and few are), you can simply configure your software to update the time more frequently (eg every hour or every 10 minutes, etc.)

To pick an update frequency, you can disable all update functions and software, wait a significant amount of time (eg 24 hours, 1 week, etc.), and then manually trigger an update and observe the difference to see how many seconds (or minutes‽) it was off by. You can use that to determine a good interval that allows you to keep the system time correct without making excessive, unnecessary calls out to the time server.

share|improve this answer
add comment

Windows 7, by default, will synchronize it's time to time.windows.com (right click your clock, press Adjust Date/Time, and switch to the Internet Time tab to see this), which in turn synchronizes with the NIST (National Institute of Standards and Technology), maintainers of the "official time" in the US. You can synchronize to the NIST directly via the NIST Internet Time Service. time.nist.gov is the best-known NIST-ITS server, but it's recommended against because high load makes it unreliable. Instead, use one of the other official servers listed at the NIST-ITS webpage. I use ntp-nist.ldsbc.edu (mirror provided by the LDS Business College) on the west coast and nist1.columbiacountyga.gov (Columbia County, GA government) on the east coast, because both are official NIST-ITS mirrors but are fairly obscure so load is low (= fast and reliable sync).

On a more technical level, the NTP system should ensure a time accuracy well below one second (theoretical accuracy is apparently in the nanosecond range, but that requires a large pool of time sources).

Your exact reference depends on your exact application; the NIST-ITS provides a time that is official for US Government purposes and accepted as the standard by most industries. Other highly time-synchronized systems, though, might operate to a different standard. For example, the GPS system was initially synchronized to the USNO Reference Time, provided by the US Navy, which is standard amongst the armed forces and precisely synchronized with the NIST time. But, over time two differences have appeared: (1) the GPS time does not account for leap-seconds while the NIST/USNO time does, so GPS time is now 14 seconds behind, and (2) because time synchronization between GPS satellites is ad-hoc, it can acceptably deviate from the NIST/USNO time by severall hundred ns. I doubt times in the nanoseconds will matter in your application, but that 14 seconds is a pretty big difference that you'll need to compensate for if you choose to receive GPS time. Don't worry, the GPS system broadcasts the current offset. more details here.

The cellphone networks are not as highly synchronized as people seem to think. Cell phones do get their time from towers, but towers maintain their own clocks and may deviate by as much as 1-2 minutes at times from the network average. I believe towers do attempt to synchronize, but they don't seem to do it well. Look at your phone and a friends phone and you'll probably find that they show a time a few seconds off. I think this is because phones accelerate time at a limited rate to sync with each tower, in order to avoid there being an obvious jumping around of the time as you move.

Other countries will have their own national official time, which is usually kept in good synchronization with NIST time (for example, I believe by diplomatic agreement the UK's standards agency works with the NIST to maintain exact synchronization across the ocean), but may vary somewhat.

If you want to get really interesting, the NIST does provide machine-readable radio broadcasts via their shortwave station WWV. These broadcasts can be received throughout the US and much of the world. When you see "atomic" wall clocks and such they work by synchronizing to this signal.

Isn't time interesting?

share|improve this answer
    
> Windows 7, by default, will synchronize it's time to time.windows.com So does XP; assuming of course that he is even using Windows. –  Synetech Aug 1 '11 at 6:48
    
Did it? useful to know. I had thought that XP had had it disabled by default. –  jcrawfordor Aug 2 '11 at 0:26
    
I don’t recall if it was ever disabled, but I’d bet that if it were, it was changed with SP2, just like several other things were suddenly changed (some things became disabled while others became enabled by default). Either way, it was time.windows.com in XP. –  Synetech Aug 2 '11 at 1:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.