Skip to content

Chrony Integration

TimeNow can feed solar time offsets to chrony as an SHM reference clock, allowing you to monitor the deviation between civil (UTC) and local solar time through standard NTP tooling.

How It Works

The TimeNow daemon writes solar offset data to /dev/shm/timenow in a format compatible with chrony's SHM refclock driver. This lets chrony treat the solar offset as an informational reference clock (stratum 10) alongside real NTP sources.

timenow-daemon ──► /dev/shm/timenow ──► chrony (SHM refclock)
                                         chronyc sources
                                         SOLR #0  ... +1054s

SHM File Format (C Daemon)

The C daemon writes the following key-value pairs to /dev/shm/timenow:

offset=-1054.234567000
clock_sec=1705318200
clock_nsec=123456789
precision=-10
leap=0
Field Description
offset Solar offset from UTC in seconds
clock_sec Unix timestamp (seconds)
clock_nsec Nanoseconds within the second
precision Log₂ precision estimate
leap Leap second indicator (0 = normal)

Rust Daemon

The Rust daemon writes a simplified offset value to /dev/shm/timenow_rs. For full chrony SHM integration, use the C daemon.

Setup

1. Install and Run the Daemon

cd daemon && make && sudo make install
sudo systemctl enable --now timenow-daemon

Or run manually:

./timenow-daemon --lat=48.2 --lng=16.37 --foreground

2. Configure Chrony

Add the following to /etc/chrony.conf:

# TimeNow solar offset as informational SHM refclock
refclock SHM 1 refid SOLR stratum 10 delay 0.1

Note

Stratum 10 ensures chrony will never prefer the solar reference over real NTP servers. This is purely informational — it tracks the deviation between civil and solar time.

3. Restart Chrony

sudo systemctl restart chronyd

4. Verify

chronyc sources -v

Expected Output

MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp.ubuntu.com                2   6   377    34   +0.234ms[+0.198ms] +/-  45ms
^- time.cloudflare.com           3   6   377    35   -1.023ms[-1.058ms] +/-  52ms
#? SOLR                         10   4   377     1  +1054s[+1054s] +/-  100ms

The SOLR line shows the current deviation between UTC and local solar time. A positive offset means solar noon has not yet occurred; a negative offset means it has passed.

Use Cases

  • Monitor civil/solar deviation — Track how far ahead or behind local solar time is from your clock throughout the day.
  • Log solar offset alongside NTP statistics — Correlate solar position with network time data for research.
  • Scientific research — Study timekeeping, circadian rhythms, or historical time standards.
  • Observatory automation — Integrate solar position awareness into telescope scheduling systems.

Troubleshooting

SOLR source shows ? reach

The daemon may not be running or the SHM file is not being written:

# Check daemon status
systemctl status timenow-daemon

# Check SHM file exists
cat /dev/shm/timenow

Offset value seems wrong

Verify your latitude and longitude are correct. The solar offset depends on your position within your timezone — locations at the eastern edge of a timezone will have a smaller offset than those at the western edge.