summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-08-06 15:17:34 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-08-06 15:17:34 -0700
commit8ed81fc62d8d0c70177b5a8c28a6c7fd34ab6729 (patch)
treefe7cf5fed69a71f51bb30c7f281010bff5264172
parent3df85966bd608863cf5ed02b85385d0b33665482 (diff)
downloadbackomp-8ed81fc62d8d0c70177b5a8c28a6c7fd34ab6729.tar.gz
backomp-8ed81fc62d8d0c70177b5a8c28a6c7fd34ab6729.tar.xz
fully support pre-epoch timestamps
not sure why, but why not
-rwxr-xr-xbackomp15
1 files changed, 6 insertions, 9 deletions
diff --git a/backomp b/backomp
index 1d465fa..afc9b96 100755
--- a/backomp
+++ b/backomp
@@ -16,7 +16,7 @@ EOF
read -rd '' AWK_FILTER <<'EOF'
function flr(n, s) {
- return int(n / s) * s
+ return n - (((n % s) + s) % s)
}
function mstart(t) {
@@ -36,10 +36,10 @@ BEGIN {
buckets[++n_buckets] = b
}
- split("sun mon tue wed thu fri sat", arr)
+ split("mon tue wed thu fri sat sun", arr)
for (i in arr)
arr2[arr[i]] = i - 1
- wshift = (11 - arr2[opt_week_start])*24*60*60
+ wshift = (10 - arr2[opt_week_start])*24*60*60
}
!n_buckets || keep_first && NR == 1 {
@@ -49,10 +49,6 @@ BEGIN {
n_buckets {
t = mktime(gensub(/(.*\/|^)(.+)-(..)-(..)-(..)(..)(..)$/,
"\\2 \\3 \\4 \\5 \\6 \\7", 1), 1)
- if (t < 0) {
- ++keep[$0]
- next
- }
bt["h"] = flr(t, 60*60)
bt["d"] = flr(t, 24*60*60)
@@ -71,8 +67,9 @@ n_buckets {
}
}
- if (newest_in[b] && bt[b] == last[b, b] && (i == 1 ||
- bt[buckets[i-1]] != last[b, buckets[i-1]]))
+ if (newest_in[b] && (b, b) in last && bt[b] == last[b, b] &&
+ (i == 1 || bt[buckets[i-1]] != \
+ last[b, buckets[i-1]]))
next
if ((b, bt[b]) in bkeep || ret[b] == "*" || bc[b]++ < ret[b])