diff options
| author | wukong <wukong@longaeva> | 2026-06-09 10:47:09 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2026-06-09 10:47:09 -0700 |
| commit | 7fb50be1944f3a76a285ac04423ae233728b5bf7 (patch) | |
| tree | 957548d230a9ab48eb80dac4d8ee5e493cbaea6d /ckt0.awk | |
| parent | 40548183b45666afc50373b0ee172465660fc479 (diff) | |
merge code between ckcptime and ckt0 scripts;
added btime check from /proc/stat in ckt0.awk;
Diffstat (limited to 'ckt0.awk')
| -rw-r--r-- | ckt0.awk | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -75,6 +75,7 @@ function ck_boottime(unm) { gsub(":", " ", t0_k_arr[4]) t0_k = sprintf("%04d %02d %02d %s", t0_k_arr[5], t0_k_arr[2], t0_k_arr[3], t0_k_arr[4]) t0_k = mktime(t0_k) + delete t0_k_arr } if (unm ~/FreeBSD/ || unm ~/Darwin/) { @@ -87,6 +88,18 @@ function ck_boottime(unm) { sub("^.*= ", "", t0_k_arr[n]) } t0_k = t0_k_arr[1] "." t0_k_arr[2] + delete t0_k_arr + } + + if (unm ~/Linux/) { + while( getline proc_stat < "/proc/stat" > 0 ) { + if (proc_stat ~ "btime") { + split(proc_stat, t0_k_arr) + t0_k = t0_k_arr[2] + delete t0_k_arr + } + } + close("/proc/stat") } else { |
