2020-07-30 16:20:24 -07:00
|
|
|
|
2020-03-10 18:37:55 -07:00
|
|
|
# jc.parsers.timedatectl
|
|
|
|
jc - JSON CLI output utility timedatectl Parser
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
specify --timedatectl as the first argument if the piped input is coming from timedatectl or timedatectl status
|
|
|
|
|
|
|
|
Compatibility:
|
|
|
|
|
|
|
|
'linux'
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
$ timedatectl | jc --timedatectl -p
|
|
|
|
{
|
|
|
|
"local_time": "Tue 2020-03-10 17:53:21 PDT",
|
|
|
|
"universal_time": "Wed 2020-03-11 00:53:21 UTC",
|
|
|
|
"rtc_time": "Wed 2020-03-11 00:53:21",
|
|
|
|
"time_zone": "America/Los_Angeles (PDT, -0700)",
|
|
|
|
"ntp_enabled": true,
|
|
|
|
"ntp_synchronized": true,
|
|
|
|
"rtc_in_local_tz": false,
|
|
|
|
"dst_active": true
|
|
|
|
}
|
|
|
|
|
|
|
|
$ timedatectl | jc --timedatectl -p -r
|
|
|
|
{
|
|
|
|
"local_time": "Tue 2020-03-10 17:53:21 PDT",
|
|
|
|
"universal_time": "Wed 2020-03-11 00:53:21 UTC",
|
|
|
|
"rtc_time": "Wed 2020-03-11 00:53:21",
|
|
|
|
"time_zone": "America/Los_Angeles (PDT, -0700)",
|
|
|
|
"ntp_enabled": "yes",
|
|
|
|
"ntp_synchronized": "yes",
|
|
|
|
"rtc_in_local_tz": "no",
|
|
|
|
"dst_active": "yes"
|
|
|
|
}
|
|
|
|
|
2020-07-30 16:20:24 -07:00
|
|
|
|
2020-03-10 18:37:55 -07:00
|
|
|
## info
|
|
|
|
```python
|
2020-07-30 16:20:24 -07:00
|
|
|
info()
|
2020-03-10 18:37:55 -07:00
|
|
|
```
|
|
|
|
|
2020-07-30 16:20:24 -07:00
|
|
|
|
2020-03-10 18:37:55 -07:00
|
|
|
## process
|
|
|
|
```python
|
|
|
|
process(proc_data)
|
|
|
|
```
|
|
|
|
|
|
|
|
Final processing to conform to the schema.
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
proc_data: (dictionary) raw structured data to process
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
Dictionary. Structured data with the following schema:
|
|
|
|
|
|
|
|
{
|
2020-03-10 20:26:53 -07:00
|
|
|
"local_time": string,
|
|
|
|
"universal_time": string,
|
|
|
|
"rtc_time": string,
|
|
|
|
"time_zone": string,
|
|
|
|
"ntp_enabled": boolean,
|
|
|
|
"ntp_synchronized": boolean,
|
|
|
|
"system_clock_synchronized": boolean,
|
|
|
|
"systemd-timesyncd.service_active": boolean,
|
|
|
|
"rtc_in_local_tz": boolean,
|
|
|
|
"dst_active": boolean
|
2020-03-10 18:37:55 -07:00
|
|
|
}
|
|
|
|
|
2020-07-30 16:20:24 -07:00
|
|
|
|
2020-03-10 18:37:55 -07:00
|
|
|
## parse
|
|
|
|
```python
|
|
|
|
parse(data, raw=False, quiet=False)
|
|
|
|
```
|
|
|
|
|
|
|
|
Main text parsing function
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
data: (string) text data to parse
|
|
|
|
raw: (boolean) output preprocessed JSON if True
|
|
|
|
quiet: (boolean) suppress warning messages if True
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
Dictionary. Raw or processed structured data.
|
|
|
|
|