about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2020-12-23 00:13:05 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-01-07 18:06:43 +0100
commit6e3598566c65bebc37acc8230fc2159c89518dc3 (patch)
tree58682944dacbbc3a6b172a8767386099dca937f5
parent2de8262c590c5de28a1761be531ccf8453cd8129 (diff)
downloadsnooze-6e3598566c65bebc37acc8230fc2159c89518dc3.tar.gz
snooze-6e3598566c65bebc37acc8230fc2159c89518dc3.tar.xz
snooze-6e3598566c65bebc37acc8230fc2159c89518dc3.zip
Change timefile calculations to respect slack
% touch -t $(date -d '7 days ago' +%Y%m%d0000) somefile
% ls -l somefile
-rw-r--r-- 1 henk henk 0 Dez 16 00:00 somefile

Before this change:
% /usr/bin/snooze -nv -s 30d -H 5 -t somefile -T 30m
2020-12-23T05:00:00+0100 Wed  0d  4h 32m 24s
2020-12-24T05:00:00+0100 Thu  1d  4h 32m 24s
2020-12-25T05:00:00+0100 Fri  2d  4h 32m 24s
2020-12-26T05:00:00+0100 Sat  3d  4h 32m 24s
2020-12-27T05:00:00+0100 Sun  4d  4h 32m 24s

After this change:
% ./snooze -nv -s 30d -H 5 -t somefile -T 30m
2020-12-16T05:00:00+0100 Wed -6d-19h-27m-43s
2020-12-17T05:00:00+0100 Thu -5d-19h-27m-43s
2020-12-18T05:00:00+0100 Fri -4d-19h-27m-43s
2020-12-19T05:00:00+0100 Sat -3d-19h-27m-43s
2020-12-20T05:00:00+0100 Sun -2d-19h-27m-43s
-rw-r--r--snooze.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/snooze.c b/snooze.c
index 730fb4b..1301c76 100644
--- a/snooze.c
+++ b/snooze.c
@@ -301,7 +301,7 @@ main(int argc, char *argv[])
 				t = find_next(t + 1);
 			start = t;
 		} else {
-			if (t + timewait > start)
+			if (t + timewait > start - slack)
 				start = st.st_mtime + timewait;
 		}
 	}