From b693f9aa9bc33d512e6f6a8560fb5254b33c5275 Mon Sep 17 00:00:00 2001 From: Hendrik Jäger Date: Wed, 23 Dec 2020 00:13:05 +0100 Subject: 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 --- snooze.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'snooze.c') 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; } } -- cgit v1.2.3