Skip to content
jc-rs
GitHub

timedatectl

--timedatectlv1.8.0

Converts `timedatectl status` command output to JSON

Linuxcommand
$ timedatectl | jc-rs --timedatectl

A real pair

From the reference corpus (ubuntu-18.04/timedatectl.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

timedatectlubuntu-18.04
                      Local time: Wed 2020-03-11 00:51:11 UTC
                  Universal time: Wed 2020-03-11 00:51:11 UTC
                        RTC time: Wed 2020-03-11 00:51:11
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
{
  "local_time": "Wed 2020-03-11 00:51:11 UTC",
  "universal_time": "Wed 2020-03-11 00:51:11 UTC",
  "rtc_time": "Wed 2020-03-11 00:51:11",
  "time_zone": "Etc/UTC (UTC, +0000)",
  "system_clock_synchronized": true,
  "systemd-timesyncd.service_active": true,
  "rtc_in_local_tz": false,
  "epoch_utc": 1583887871
}

Fixture coverage

4/4oracle-valid pairs match under the published structural JSON comparison

Magic syntax

jc-rs timedatectljc-rs runs the command itself and parses what it prints. Recognised for: `timedatectl`, `timedatectl status`

Source: crates/jc-rs-parsers/src/system/timedatectl.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare