Computers keep time with a small crystal and a battery, and left alone they drift. A virtual machine that was paused, a container host with a bad time source or a firewall that blocks NTP can run minutes or even days away from real time. Email is surprisingly sensitive to this. The Date header looks wrong, DKIM signatures appear to come from the future, TLS certificates are rejected as not yet valid or expired, one-time codes arrive "expired", retries fire at the wrong moment and logs from different servers cannot be lined up. Because the symptoms appear in so many places, time problems are easy to miss. This guide lists what clock errors break, how to diagnose them, how to keep servers in sync and what to monitor. It builds on the Date header, DKIM signed headers and reading mail logs.
What a wrong clock affects
| Area | What goes wrong | What you see |
|---|---|---|
| Date header | The sender stamps the message with its own clock. Large errors look suspicious. See Date header | Spam points for dates far in the past or future; messages sorted wrongly in inboxes |
| DKIM signing | The t= tag records the signing time and x= the expiry. A fast clock produces signatures "from the future"; a slow clock can produce signatures that appear already expired | Verification failures or "signature not yet valid" on some receivers |
| DKIM verification | A receiving server with a wrong clock rejects valid signatures with x= in the past or timestamps in the future | Intermittent dkim=fail from one receiver only |
| TLS certificates | Validity periods are checked against the local clock | "Certificate is not yet valid" or "certificate has expired" even though the certificate is fine. See certificates |
| MTA-STS and DANE policies | Policy lifetimes and signature validity depend on time | Policies treated as expired or not yet valid |
| Authentication tokens | OAuth2 access tokens, JWTs and signed URLs include timestamps. See OAuth2 for SMTP | Invalid-token errors or unexpectedly short lifetimes |
| One-time codes and magic links | Expiry is calculated from the server clock | Codes expire before the user reads them, or never expire |
| Queue and retry scheduling | Retry intervals and queue lifetime use local time. See retry schedules | Mail retried too soon, or bounced early, after a clock jump |
| Logs and tracing | Timestamps from several servers cannot be correlated | Impossible sequences, such as delivery before submission |
| Rate limits | Per-hour and per-day counters reset on local time | Limits that reset at the wrong moment |
| Scheduled campaigns | Send times are based on server time and time zone settings | Campaigns delivered hours early or late. See time zones |
Time zone is not the same as clock accuracy
Two different problems are often confused. Clock accuracy is whether the machine's notion of the absolute moment is right; the time zone merely affects how that moment is displayed. Email headers carry an explicit zone offset (for example +0530), so a message stamped in a different zone is correct if the offset is right. A server with the right clock but a missing or wrong zone setting produces headers that show an offset of +0000 while local time is something else, which is harmless to machines but confusing to people reading logs. Run servers in UTC, convert for display and make applications store UTC timestamps. The real danger is a wrong absolute time, which misleads every system that uses it for validation.
Keeping time right
- Use a time daemon. chrony (preferred on modern Linux, especially virtual machines) or ntpd, or systemd-timesyncd for simple cases. Windows servers use the Windows Time service, configured to follow a domain controller or a public pool.
- Use several sources. Configure at least three or four servers (a public pool, your provider's time service and an internal source). One source gives no way to detect a bad one.
- Allow the traffic. NTP uses UDP port 123. Many hardened networks block it; open it to the chosen sources only.
- Handle virtual machines properly. After a pause, snapshot restore or live migration the clock can jump. Enable the hypervisor time-sync feature or configure chrony to step the clock quickly when the offset is large (the
makestepdirective). - Check containers. Containers share the host clock; fix the host, not the container.
- Set the zone to UTC on mail servers and application hosts to avoid daylight-saving surprises.
- Guard against drift on a schedule. A host that is fine today can drift after a reboot or a firewall change. Monitor, do not assume.
# chrony: status and offset
chronyc tracking
chronyc sources -v
# systemd hosts
timedatectl status # look for "System clock synchronized: yes"
# Quick comparison with a reference (prints offset in seconds)
chronyc -a 'burst 4/4' && chronyc -a makestep # only when you intend to step the clock
# Sample /etc/chrony/chrony.conf lines
pool 2.pool.ntp.org iburst
makestep 1.0 3
rtcsyncDiagnosing a suspected time problem
- Compare the server's clock with a trusted reference (a phone synchronised to the network, a public time site, or a second server you trust).
- Send a test message and look at three timestamps in its headers: the
Dateheader (set by the sender), the firstReceivedline (set by the first server) and the lastReceivedline (set by the recipient's system). They should agree within a few seconds. See reading Received headers. - Read the DKIM-Signature
t=value (a Unix time) and convert it. It should be the moment the message was sent. - Check TLS errors in the logs for "not yet valid" or "expired" messages while the certificate dates are correct.
- Look for sudden jumps in the log timeline, which suggest the clock was stepped.
- Fix the time source, then retest and verify that queued and scheduled mail is still correct. Mail queued during a large clock error may have wrong due times.
# Convert the DKIM t= value to a readable date
date -u -d @1738490400
# Show the server's current UTC time for comparison
date -uMonitoring
| Metric | Alert when |
|---|---|
| NTP offset per host | Absolute offset above 0.5 seconds (warning) or 5 seconds (critical) |
| Time source reachability | No source reachable for more than a few minutes |
| Clock step events | Any step larger than one second outside planned maintenance |
| Certificate validity errors in logs | Any occurrence of "not yet valid" |
| DKIM failures at one receiver only | Sustained, with no change in your signing |
| Gap between Date header and first Received timestamp | Above a few seconds on average |
Special cases
- Leap seconds. Providers handle them with smearing or stepping; avoid mixing smeared and non-smeared sources in one configuration.
- Hosts restored from backup. A restored machine may wake with an old clock and send mail with old dates until it syncs; delay the start of mail services until time is synchronised.
- Embedded devices and printers that send scan-to-email often have unset clocks (dated 1970 or years ago) and no time sync. Spam filters flag such messages; give them a time source or route them through a relay that rewrites the Date header if policy allows.
- Multiple data centres. Use the same source set everywhere so that offsets between sites stay small.
Time synchronisation is dull infrastructure that nobody notices until it fails. Run a proper time daemon with several sources, keep servers on UTC, monitor offsets and treat unexplained date, signature or certificate problems as a possible clock issue before changing anything else.
Test a message end to end Check authentication and headers on your sending domain.
References and further reading
Frequently asked questions
How does a wrong server clock affect email?
It can produce bad Date headers, DKIM timestamps in the future or past, TLS certificate errors, expired codes and confusing logs.
Which time service should a mail server use?
chrony or ntpd on Linux with several reliable sources, or the Windows Time service configured to a trusted source.
Should servers run in UTC?
Yes. UTC avoids daylight-saving problems; convert to local time only for display.
How can I tell if the clock is the problem?
Compare the Date header, Received timestamps and DKIM t= value with a trusted reference.
What offset is acceptable?
Keep it within a second if you can and alert above about half a second to a few seconds.