Time, Timezones, and NTP
Why Time Is a Production Dependency
Time is not just a display setting. It is a dependency. If server clocks drift, production systems fail in strange ways: TLS breaks, logs become useless, distributed systems disagree, and debugging turns into guesswork.
Common Symptoms of Bad Time
- TLS/SSL errors (“certificate not yet valid”, “expired”)
- Authentication failures (JWT, OAuth, session timeouts)
- Replication lag and out-of-order events
- Logs that appear out of sequence
- Cache TTL behaving incorrectly
UTC vs Local Timezone
Production best practice: use UTC on servers unless you have a very strong reason not to. UTC avoids daylight saving problems and makes correlation across systems easier. Local timezone is fine for user-facing apps, but infrastructure should prefer UTC.
Check Current Time Settings
timedatectl date
Look for:
- Time zone
- NTP service status
- System clock synchronized: yes/no
NTP: How Servers Stay Correct
NTP keeps system time aligned with trusted sources. Most distros use one of:
- systemd-timesyncd (simple, built-in)
- chrony (more robust, preferred for many production setups)
systemd-timesyncd Basics
systemctl status systemd-timesyncd timedatectl show-timesync
Configure servers:
/etc/systemd/timesyncd.conf
chrony Basics
Chrony is often preferred for production because it handles unstable networks better.
systemctl status chronyd chronyc tracking chronyc sources
Do Not Manually Set Time in Production
Manually changing the clock can break running systems (databases, caches, auth). If time is wrong, fix synchronization, not just the displayed value. Only use manual changes in emergency situations with a clear plan.
Time and TLS Certificates
Certificates rely on time validity windows. If your server clock is behind or ahead, clients can reject valid certificates. Always check time before assuming “certificate problem”.
Time in Logs and Incident Debugging
During incidents, logs are your truth source. If time is inconsistent:
- Cross-service correlation becomes unreliable
- Alert timelines become misleading
- Root cause analysis becomes slower
Production Hard Rules
- Enable NTP and verify sync
- Prefer UTC on servers
- Monitor clock sync status
- Investigate time drift as a first-class incident cause
Quick Verification Checklist
timedatectl journalctl -u systemd-timesyncd -n 50 --no-pager chronyc tracking
Mental Model
Time is part of system correctness. If distributed systems are “not agreeing”, time is one of the first things to verify. Production engineering treats time sync like networking: invisible until it breaks everything.
Production Checklist
- NTP enabled and synchronized
- Timezone decision documented (prefer UTC)
- Alerting on time sync failures
- Time checked during TLS/auth incidents