3 releases

0.1.2 Feb 26, 2024
0.1.1 Dec 24, 2021
0.1.0 Nov 1, 2021

#190 in Date and time

Download history 90/week @ 2024-07-20 108/week @ 2024-07-27 27/week @ 2024-08-03 72/week @ 2024-08-10 90/week @ 2024-08-17 125/week @ 2024-08-24 52/week @ 2024-08-31 101/week @ 2024-09-07 249/week @ 2024-09-14 495/week @ 2024-09-21 111/week @ 2024-09-28 67/week @ 2024-10-05 136/week @ 2024-10-12 118/week @ 2024-10-19 365/week @ 2024-10-26 546/week @ 2024-11-02

1,176 downloads per month
Used in clock-bound-d

GPL-2.0-only

70KB
2K SLoC

chrony-candm

chrony-candm is a Rust crate for communicating with Chrony's control & monitoring interface. It provides programmatic access to information about Chrony's status that one would otherwise have to scrape from the output of chronyc. For API documentation, see docs.rs.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the GNU General Public License, version 2.0. For details, see LICENSE. See NOTICE and THIRD-PARTY respectively for first- and third-party copyright notices and acknowledgements.

chrony-candm is a community contribution from Amazon and is not affiliated with the Chrony project.


lib.rs:

This crate is a library for communicating with Chrony's control & monitoring interface. It provides programmatic access to information that you'd otherwise have to scrape from the output of chronyc.

For simple use cases which involve non-privileged queries to the locally-running Chrony daemon, your main entry-point into the library will be the [blocking_query] function with a server argument of &LOCAL_SERVER_ADDR. For privileged commands, use [blocking_query_uds] instead (this will require permissions to write to the /var/run/chrony directory).

use chrony_candm::request::RequestBody;
use chrony_candm::reply::ReplyBody;
use chrony_candm::{blocking_query,LOCAL_SERVER_ADDR};

let request_body = RequestBody::Tracking;
let options = Default::default();
let reply = blocking_query(request_body, options, &LOCAL_SERVER_ADDR)?;
if let ReplyBody::Tracking(tracking) = reply.body {
    println!("The current RMS offset is {} seconds.", tracking.rms_offset);
}

Asynchronous applications can use [Client] instead of the standalone blocking_query and blocking_query_uds functions.

Dependencies

~2–10MB
~110K SLoC