A machine whose clock is wrong causes small, baffling problems: logins that fail, certificates reported as invalid, files that appear to have been edited before they were created, calendar entries an hour out. The fix takes about a minute. This guide shows how to sync your computer clock on every common platform, choose a sensible time server, and work out what is wrong when the correction refuses to take.
Every operating system below ships with a client for the Network Time Protocol, so in most cases the work is limited to switching on a setting that should have been on already. Before you start, it is worth knowing how far out you actually are: the clock sync check compares your device against a server reference and reports the difference in milliseconds.
How Do You Sync Your Computer Clock on Windows?
Open Settings, go to Time & language, then Date & time. Switch on Set time automatically, confirm the time zone is right, and press the Sync now button. The clock corrects itself within a few seconds.
The server it contacts is shown beside that button, and by default it is time.windows.com. To change it, open the classic Date and Time control panel, choose the Internet Time tab, and enter a different address. Two commands are useful when the graphical route does not help. Running w32tm /query /status in an administrator prompt reports the current source, the poll interval and when the last correction happened. The command w32tm /resync asks for a fresh sync straight away. If the machine belongs to a company domain, leave the settings alone: domain members take their time from the domain controller hierarchy, and pointing one at an external server breaks that chain and can prevent logins. Windows historically kept fairly loose time, within a second or two, though recent releases can hold far tighter margins when configured for it.
How to Sync Your Computer Clock on macOS
Open System Settings, choose General, then Date & Time. Turn on Set time and date automatically, and turn on the option to set the time zone from your location if you travel. Nothing else is required, and the machine will sync quietly from then on.
The source field alongside the toggle shows the server in use, normally time.apple.com, and it can be replaced with any address you prefer. When the interface refuses to update, the Terminal command sudo sntp -sS time.apple.com sets the clock immediately from that server and reports the offset it corrected, which also tells you whether the network is reachable at all. On older macOS versions the same settings live in System Preferences under Date & Time, with a padlock that must be unlocked first.
Linux: timedatectl, chrony and ntpd
Run timedatectl in a terminal. The output states whether the system clock is synchronized and whether the time service is active, which answers the question before you change anything. Enable it with sudo timedatectl set-ntp true.
That switches on systemd-timesyncd, a lightweight client that is perfectly adequate for a desktop. Servers, laptops that suspend often and anything needing tighter accuracy are better served by chrony, which handles interrupted networks and variable delays far more gracefully. Its useful commands are short:
- chronyc tracking: shows the sync source, the current offset and the estimated drift rate of the local oscillator.
- chronyc sources -v: lists every configured server with its stratum, reachability and measured offset, with the selected one marked.
- sudo chronyc makestep: applies the outstanding correction immediately rather than waiting for it to be absorbed gradually.
- ntpq -p: the equivalent listing on systems still running the classic ntpd daemon, where an asterisk marks the chosen peer.
Servers are listed in the chrony configuration file, usually under /etc, and the distribution’s defaults are almost always fine. Only one time service should be running: chrony and timesyncd active together will fight each other for control of the clock.
iPhone, iPad and Android
On iOS and iPadOS, open Settings, tap General, then Date & Time, and switch on Set Automatically. On Android, the equivalent lives under Settings, System, Date and time, where the automatic date and time option should be enabled.
Neither platform lets you choose a server, and neither reports an offset, which makes phones harder to diagnose. If the option is greyed out on iOS the device is probably managed by an employer’s mobile device management profile. Android may take its time from the mobile carrier rather than from the internet, so a phone on a poorly configured network can be wrong even with everything switched on. Toggling the setting off, waiting a moment and switching it back on forces a fresh sync, and a restart usually clears anything that survives that.
Which Time Server Should You Use?
For almost everyone, the default supplied by the operating system is correct and needs no thought. Change it only when the default is unreachable, when policy demands a particular source, or when you want several independent servers to sync against instead of one.
- pool.ntp.org: a volunteer pool of several thousand servers that hands out different addresses each time it is queried. Regional forms such as uk.pool.ntp.org or europe.pool.ntp.org pick nearer machines and give shorter, steadier paths.
- Vendor servers: time.windows.com, time.apple.com and time.google.com are well run and close to most users, and they are the sensible default on their own platforms.
- National laboratories: NIST in the United States and its counterparts elsewhere operate public servers only a step removed from a caesium standard, described in national time standards.
- Your own network: a router or domain controller can act as the sync source for every machine in the building, which often matters more than agreeing with the outside world.
Two rules are worth following. Configure three or four sources rather than one, so a single misbehaving server can be outvoted; and avoid mixing servers that smear leap seconds, as some large providers do, with servers that do not, because during a smear the two disagree by up to a second. The reasoning behind both is covered in what NTP is and how it works.
What to Do When Synchronisation Fails
Work through the causes in order of likelihood. Almost every failure is a blocked port, a time zone mistake, a dead battery, or two services competing for the same clock.
- Blocked port: sync traffic uses UDP port 123, which corporate, hotel and campus networks often filter. A machine that cannot reach any server will report no source at all.
- Wrong time zone: if the clock is out by a whole number of hours the underlying time is probably correct and the zone is not. Fix the zone rather than the time.
- Flat CMOS battery: a desktop that resets its clock to an old date after every power-off needs a new coin cell, not a better time server.
- Dual-boot mismatch: Windows stores local time in the hardware clock while Linux stores UTC, so the two disagree by your zone offset. Configure one of them to match the other.
- Offset too large: a client that finds itself hundreds of seconds out may refuse to move, treating the difference as a fault. Set the clock roughly by hand, then restart the service.
- Virtual machines: hypervisor tools and a guest daemon both correcting the same clock will fight. Disable one of the two.
Once a sync succeeds, a clock should stay within milliseconds indefinitely, because the client learns the oscillator’s error and compensates for it continuously. If yours wanders again within hours, the underlying quartz is unusually poor or the machine is sleeping often, a problem examined in why computer clocks drift.
Conclusion
To sync your computer clock, switch on automatic time, confirm the time zone, and force a single manual correction to prove the path works. Windows, macOS, Linux, iOS and Android all do the same job behind slightly different labels, and the defaults they ship with are good enough for anything short of professional timekeeping. When it fails, suspect the network and the time zone before anything else. Check the result on the clock accuracy checker, compare it against the live atomic time display, or start from the atomicclock.now homepage.