commit 89df94e8ac613d829fbfbea0e312bd94b99ea59d
parent ee4c6e6106095bc3f3948a14ac41aa9d0fb0c1bb
Author: in0rdr <andreas.gruhler@uzh.ch>
Date: Mon, 26 Dec 2016 22:08:56 +0100
remove duplicate step de/increase
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/diary.c b/diary.c
@@ -273,16 +273,15 @@ struct tm find_closest_entry(const struct tm current,
int step = search_backwards ? -1 : +1;
struct tm it = current;
- it.tm_mday += step;
-
time_t it_time = mktime(&it);
+
for( ; it_time >= start_time && it_time <= end_time; it_time = mktime(&it)) {
+ it.tm_mday += step;
if (date_has_entry(diary_dir, diary_dir_size, &it)) {
return it;
}
- it.tm_mday += step;
}
return current;