Cross-platform, high-precision NTP synchronization agent with auto-fallback and nanosecond telemetry.
-
Cross-platform: Supports Windows, Linux, macOS
-
Dynamic pool selection: Automatically picks the first reachable NTP or NTPsec pool
-
High-precision drift correction: Nanosecond-level skew measurement & adjustment
-
Modes:
fast
– checks every 60 sultrafast
– continuous polling with nanosecond precisionlazy
– checks every 30 minutes
-
Memoization: Stores last skew in JSON to avoid unnecessary corrections
-
Telemetry: Logs skew, service status, and NTP peer info to
status.log
-
Resilience: Falls back to alternative pools if DNS or server fails
-
SYSTEM service integration (Windows): Automatically installs via NSSM
-
Cross-platform scheduling: Uses Scheduled Tasks (Windows) or cron/systemd timers (Unix)
- Install Python 3.9+
- Install NSSM: https://nssm.cc/download (Optional for service handling)
- Clone or download this repository
- Edit
time-sync-agent.bat
with your Python path and dispatcher path - Run manually once to verify:
time-sync-agent.bat
- To install as a SYSTEM service (via NSSM):
python -m dispatchService --mode=fast
- Install Python 3.9+
- Install chrony or NTPsec
- Clone this repository
- Run dispatcher manually:
python3 dispatcher.py --mode=fast
- Optional: schedule with
cron
orsystemd
:
# Every 5 minutes
*/5 * * * * /usr/bin/python3 /path/to/dispatcher.py --mode=fast
# Default fast mode
python -m dispatchService --mode=fast
# Ultrafast continuous nanosecond polling
python -m dispatchService --mode=ultrafast
# Lazy mode (low frequency)
python -m dispatchService --mode=lazy
# Optional: force a specific pool
python -m dispatchService --mode=fast --pool=pool.chrony.eu
-
Pools: Default dispatcher list includes NTP, NTPsec, Cloudflare, Google pools
-
Modes: Adjust
CHECK_INTERVAL
andPRECISION_THRESHOLD_NS
per mode indispatcher.py
-
Logging: Telemetry stored in:
- Windows:
%ProgramData%\TimeSync\status.log
- Unix:
/var/log/time-sync/status.log
- Windows:
-
Memoization: Last skew stored in
memo.json
alongside logs
- Incremental adjustments prevent large clock jumps for small skews
- Forced resync only for large skews (>100 ms)
- Supports NTPsec and secure NTS where available
- Windows registry & service commands fail gracefully and are fully logged
- Python 3.9+ required
- Uses asyncio for concurrency and live polling
- BAT wrapper handles Windows service bootstrap
- Pull requests welcome — maintain cross-platform compatibility
UnLicense — see LICENSE
file