How mlichvar/chrony works
Project Type and Purpose
• chrony is a system‐level time‐synchronization suite implementing NTPv4 (RFC 5905).
• It consists of:
• chronyd – the long‐running daemon that synchronises the system clock
• chronyc – the CLI client for monitoring and controlling chronyd
• It runs on Unix‐like OSes (Linux, FreeBSD, macOS, illumos), interfaces with network servers and hardware reference clocks, and applies advanced filtering/smoothing algorithms.
File Structure Analysis and Architectural Implications
• Top‐level:
• source files (.c/.h) implement virtually every subsystem
• configure/Makefile.in for build system (autoconf)
• doc/ and examples/ for user docs and sample configs
• test/ for unit, system, simulation, kernel‐interface tests
• Key subsystems visible in file names:
• Network I/O: ntp_io*.c, socket.c
• Protocol core: ntp_core.c, ntp_ext.c, ntp_auth.c, pktlength.c
• Security: NTS (nts_ke_*.c, nts_ntp_*.c), legacy NTP‐auth (keys.c)
• Time‐discipline: samplefilt.c / array.c / smooth.c / sched.c / sources.c
• Reference clocks: refclock_*.c, local*.c, hwclock.c, rtc_*.c
• System abstraction: sys_*.c (Linux, macOS, POSIX, Solaris, NetBSD), memory.c, logging.c
• CLI/Control: cmdparse.c / cmdmon.c, client.c (chronyc), clientlog.c
• Configuration: conf.c, addressing.c / addrfilt.c
• Persistence: leapdb.c, driftfile via conf
• Utility/crypto primitives: hash_*.c, cmac_*.c, siv_*.c, md5.c, getdate.*
• The project follows a layered modular architecture:
• OS abstraction layer
• Crypto & helper libraries
• Protocol stack
• Time‐discipline engine
• Device/clock drivers
• CLI & control interface
• Persistence & logging
• Confirms dual‐program architecture (daemon + CLI).
• Emphasis on network, reference clocks, NTP servers, and peer mode.