Your computer's clock drifts because the internal battery that powers it is dying, the system time settings are misconfigured, or your internet connection is too slow to sync with a time server

Every computer has a small coin-cell battery on the motherboard called a CMOS battery. When you shut down your machine, this battery keeps the system clock running so the time doesn't reset to 1970 or some other default date. When that battery weakens—usually after three to five years—the clock loses time or jumps around. You'll notice it most after the computer has been off for a while.

The second common cause is that your computer isn't syncing with a time server on the internet. Windows and macOS both have built-in services that check the correct time online and adjust your clock automatically, but if that service is disabled, turned off, or blocked by a firewall, your clock will drift. A third cause is that your system date and time settings are straightforward set wrong, either because you changed them manually or because a software conflict changed them without you noticing.

Key Takeaways

  • A dying CMOS battery on your motherboard is the most common hardware cause of a drifting clock, and replacing it costs between $10 and $30 plus labor if you take it to a technician.
  • Windows and macOS both have automatic time sync services that you can check and re-enable in your system settings without opening the computer.
  • If your clock is consistently wrong by the same amount, the problem is usually a disabled sync service rather than a dead battery.
  • A computer that shows the correct time when plugged in but drifts when unplugged almost certainly has a weak CMOS battery.

How to check if automatic time sync is turned on

On Windows 10 or 11: Open Settings, go to Time & Language, then Date & Time. Look for a toggle labeled "Set time automatically." If it is off, turn it on. Below that, check "Set time zone automatically"—if your time zone is wrong, your clock will be wrong even if the sync is working. Windows will contact a time server within a few minutes and correct the clock.

On macOS: Open System Settings, click General, then Date & Time. Check the box next to "Set date and time automatically." If it is already checked, click the dropdown menu next to it and select a different time server, then select the original one again—this forces macOS to sync when ready. If the time is still wrong after syncing, your time zone setting may be incorrect; check System Settings > General > Language & Region.

After you turn on automatic sync, wait five to ten minutes and check the clock again. If it corrects itself, the problem was a disabled sync service and you are done. If the time is still wrong, move to the next step.

How to manually set the time if sync is not working

On Windows: Right-click the clock in the bottom right corner of the taskbar and select "Adjust date/time." In the window that opens, scroll down to "Additional settings" and click "Change." A dialog will appear where you can manually enter the correct date and time. After you close it, Windows will resume automatic syncing from that point forward.

On macOS: Open System Settings > General > Date & Time. Click the lock icon in the bottom left to unlock the settings. Click the dropdown next to "Set date and time automatically" and select "Off." You can now manually enter the date and time. Once you are done, turn automatic sync back on.

If you have to manually set the time more than once a week, the automatic sync service is not working properly and you should move to the next section.

When the problem is a dying CMOS battery

If your clock is consistently wrong by the same amount every time you restart—for example, always 20 minutes behind—or if it resets to a date from years ago when you power off the computer, the CMOS battery is likely dead or dying. You will see this most clearly if you shut down the computer for several hours or overnight, then turn it back on and check the time.

Replacing a CMOS battery requires opening the computer case and locating the small round battery on the motherboard. The battery itself costs $5 to $15, but if you are not comfortable opening your computer, a technician can do it for $50 to $100 in labor. Before you pay for a replacement, confirm that automatic time sync is truly off or not working—that is a much cheaper fix.

If you decide to replace the battery yourself, look up the specific model of your computer or motherboard online to find the exact location and type of battery. The process usually takes 10 to 15 minutes: power off the computer, unplug it, press the power button to discharge any remaining power, locate the battery, gently pop it out with a plastic tool or your fingernail, and insert a new one. After you reassemble the computer and power it on, set the correct time once, and the clock should hold it from then on.

Checking your internet connection and firewall settings

If automatic time sync is turned on but your clock is still drifting, your computer may not be able to reach the time server because of a firewall or network issue. Open a web browser and visit any website—if the page loads, your internet connection is working. If you cannot reach any website, fix your internet connection first, then check the clock again.

If your internet is working but the clock is still wrong, your firewall or antivirus software may be blocking the time sync service. Most firewalls allow this traffic by default, but some security software is overly restrictive. Check your firewall settings and look for rules that block NTP (Network Time Protocol) traffic on port 123. If you find a rule blocking it, disable the rule or add an exception for the time sync service. If you are not sure how to do this, a technician can help you adjust the firewall without compromising your security.

What to do if the clock is wrong only in one process

Sometimes a single program shows the wrong time while the rest of your computer is correct. This usually means the process is reading time from a local file or database that has not been updated, not from your system clock. Restarting the process usually fixes it. If it does not, uninstall and reinstall the program.

If the wrong time appears in your web browser only, clear your browser cache and cookies, then restart the browser. If the problem persists, the website itself may be showing incorrect time—check the time on another device to confirm your computer is actually correct.

When to call a technician

You can handle most clock problems yourself by checking automatic sync and manually setting the time. Call a technician if you have turned on automatic time sync, confirmed your internet is working, and the clock is still drifting more than a few minutes per day. They can test whether the CMOS battery is failing and replace it if needed.

You should also call a technician if you are not comfortable opening your computer case or adjusting firewall settings. A technician visit typically costs $50 to $150 for diagnosis and repair, depending on whether the fix is a software adjustment or a hardware replacement.

Frequently Asked Questions

Why does my clock show the right time when I am online but the wrong time after I shut down the computer?

Your computer is syncing with a time server while it is connected to the internet, which corrects any drift. When you shut down, the CMOS battery takes over, and if that battery is weak, the clock loses time while the computer is off. When you turn it back on and reconnect to the internet, sync corrects it again. This cycle repeats until the battery dies completely.

Can a virus or malware cause my clock to be wrong?

Malware can disable automatic time sync or change your time zone settings, but it cannot directly damage the CMOS battery. If you suspect malware, run a full scan with your antivirus software. If the scan finds nothing and your clock is still wrong after you turn on automatic sync, the problem is almost certainly hardware-related, not malware.

Does my computer need to be connected to the internet for the clock to stay accurate?

No. Once your computer syncs with a time server, it can keep accurate time for weeks or months without an internet connection, as long as the CMOS battery is healthy. The sync service only needs to connect periodically—usually once a week—to correct any drift. If your computer is offline most of the time, you may need to sync manually more often.

What happens if I replace the CMOS battery and the clock is still wrong?

If a new CMOS battery does not fix the problem, the issue is not hardware. Turn on automatic time sync, check your time zone, and confirm your internet connection is working. If all three are correct and the clock is still wrong, a software conflict or corrupted system file may be the cause—a technician can run diagnostic tools to identify it.

Is it safe to open my computer to replace the CMOS battery myself?

It is safe if you take basic precautions: power off the computer completely, unplug it from the wall, press the power button to discharge residual electricity, and avoid touching other components on the motherboard. The battery itself is not dangerous. If you are nervous about it, a technician can do it quickly and inexpensively.