Skip to content

rwpenney/eng-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UTC Engineering Clock

eng-clock logo

eng-clock is a simple Rust application that shows a live display of the current time, but taking particular care to accurately synchronize screen updates to transitions from one second to the next. (Note that some desktop clock applications may simply provide updates every second, but at an arbitrary offset from these second boundaries.)

eng-clock screenshot

The application sends its own NTP requests to feed into a statistical estimator of the local system clock's offset from authoritative time references, including an estimate of the accumulated margin of error. (That offset estimator is based on a simple Bayesian Inference process assuming Gaussian statistics.) This statistical estimator includes a model of how the imprecision in the clock synchonization may drift in the absence of NTP updates, and that is used to determine dynamically when the next NTP request should occur.

The visual display is deliberately minimalistic, using only basic GTK elements.

Compilation

eng-clock can be built using the standard Cargo recipe:

cargo build --release

or for a smaller executable that uses platform-provided shared libraries:

RUSTFLAGS="-C prefer-dynamic" cargo build --release
strip target/release/eng-clock

Configuration

On startup the application will read configuration settings from ${HOME}/.config/eng-clock.toml (or the equivalent directories provided by dirs::config_dir()).

The application has a built-in set of default NTP servers, based on pool.ntp.org. More region-specific servers can be configured by including an entry of the form:

[sync]
ntp_servers = [
    "1.africa.pool.ntp.org",
    "1.asia.pool.ntp.org",
    "1.europe.pool.ntp.org",
    "1.north-america.pool.ntp.org",
    "1.oceania.pool.ntp.org",
    "1.south-america.pool.ntp.org"
]

Licensing

All files are released under the GPL-v3 and are Copyright (C) 2023 RW Penney.