diff options
| author | wukong <wukong@longaeva> | 2025-12-06 00:22:16 -0800 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2025-12-06 00:22:16 -0800 |
| commit | 062bef37b16f6b06f3147ec90fd018f361a17207 (patch) | |
| tree | 881b60eafc0140ebe2647cf3fba53ef5c59150b3 /ckt0.awk | |
| parent | a57c9ad6feac3417bfef88395a4b1ab8c6995867 (diff) | |
merged changes from FreeBSD environment;
Diffstat (limited to 'ckt0.awk')
| -rw-r--r-- | ckt0.awk | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -1,7 +1,9 @@ #!/usr/bin/env awk -f -function log10(n) { return log(n)/log(10.0) } +function log10(n) { + return log(n)/log(10.0) +} function merge_meas(est_val, est_unc, meas_val, meas_unc) { @@ -56,7 +58,22 @@ function ck_boottime() { t0_k = mktime(t0_k) } - return t0_k + if (uname ~/FreeBSD/) { + "sysctl kern.boottime" | getline t0_k + close("sysctl kern.boottime") + sub("^.*{", "", t0_k) + sub("}.*$", "", t0_k) + split(t0_k, t0_k_arr, ",") + for (n in t0_k_arr) { + sub("^.*= ", "", t0_k_arr[n]) + } + t0_k = t0_k_arr[1] "." t0_k_arr[2] + + } + + t0_k_unc = systime() + + return sprintf("%s %s", t0_k, t0_k_unc) } @@ -140,8 +157,8 @@ BEGIN { # check ARGV for previous estimate if (ARGC > 0) { - ARGV[1] ? t0_est[1] = ARGV[1] : t0_est[1] = ck_boottime() - ARGV[2] ? t0_est[2] = ARGV[2] : t0_est[2] = systime() + ARGV[1] ? t0_est[1] = ARGV[1] : split(ck_boottime(), t0_est) + ARGV[2] ? t0_est[2] = ARGV[2] : split(ck_boottime(), t0_est) } #print("t0_est = ", t0_est[1]) #print("t_boot_unc = ", t0_est[2]) |
