1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/proc_driver_rtc.md

129 lines
3.3 KiB
Markdown
Raw Normal View History

2022-09-09 16:28:34 -07:00
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_driver_rtc"></a>
2024-03-14 22:46:52 -07:00
# jc.parsers.proc_driver_rtc
2022-09-09 16:28:34 -07:00
2022-09-26 11:41:23 -07:00
jc - JSON Convert `/proc/driver/rtc` file parser
2022-09-09 16:28:34 -07:00
Usage (cli):
2022-09-26 11:41:23 -07:00
$ cat /proc/driver/rtc | jc --proc
2022-09-09 16:28:34 -07:00
or
2022-09-26 11:41:23 -07:00
$ jc /proc/driver/rtc
2022-09-09 16:28:34 -07:00
or
2022-09-26 11:41:23 -07:00
$ cat /proc/driver/rtc | jc --proc-driver-rtc
2022-09-09 16:28:34 -07:00
Usage (module):
import jc
result = jc.parse('proc', proc_driver_rtc_file)
or
import jc
result = jc.parse('proc_driver_rtc', proc_driver_rtc_file)
Schema:
2022-09-09 17:13:43 -07:00
"yes" and "no" values are converted to `true`/`false`. Integer conversions
are attempted. If you do not want this behavior, then use `--raw` (cli) or
2022-09-09 16:28:34 -07:00
`raw=True` (module).
{
"rtc_time": string,
"rtc_date": string,
"alrm_time": string,
"alrm_date": string,
"alarm_IRQ": boolean,
"alrm_pending": boolean,
"update IRQ enabled": boolean,
"periodic IRQ enabled": boolean,
"periodic IRQ frequency": integer,
"max user IRQ frequency": integer,
"24hr": boolean,
"periodic_IRQ": boolean,
"update_IRQ": boolean,
"HPET_emulated": boolean,
"BCD": boolean,
"DST_enable": boolean,
"periodic_freq": integer,
"batt_status": string
}
Examples:
2022-09-26 11:41:23 -07:00
$ cat /proc/driver/rtc | jc --proc -p
2022-09-09 16:28:34 -07:00
{
"rtc_time": "16:09:21",
"rtc_date": "2022-09-03",
"alrm_time": "00:00:00",
"alrm_date": "2022-09-03",
"alarm_IRQ": false,
"alrm_pending": false,
"update IRQ enabled": false,
"periodic IRQ enabled": false,
"periodic IRQ frequency": 1024,
"max user IRQ frequency": 64,
"24hr": true,
"periodic_IRQ": false,
"update_IRQ": false,
"HPET_emulated": true,
"BCD": true,
"DST_enable": false,
"periodic_freq": 1024,
"batt_status": "okay"
}
2022-09-26 11:41:23 -07:00
$ cat /proc/driver/rtc | jc --proc -p -r
2022-09-09 16:28:34 -07:00
{
"rtc_time": "16:09:21",
"rtc_date": "2022-09-03",
"alrm_time": "00:00:00",
"alrm_date": "2022-09-03",
"alarm_IRQ": "no",
"alrm_pending": "no",
"update IRQ enabled": "no",
"periodic IRQ enabled": "no",
"periodic IRQ frequency": "1024",
"max user IRQ frequency": "64",
"24hr": "yes",
"periodic_IRQ": "no",
"update_IRQ": "no",
"HPET_emulated": "yes",
"BCD": "yes",
"DST_enable": "no",
"periodic_freq": "1024",
"batt_status": "okay"
}
<a id="jc.parsers.proc_driver_rtc.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/proc_driver_rtc.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/proc_driver_rtc.py)
2022-09-09 16:28:34 -07:00
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)