summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-27 13:34:33 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-27 13:34:33 -0500
commit5e94b28d4a62cd590f173e0358cb3272073e4585 (patch)
treeefcf1617e80437afbf8d3685a5c28fa1290a2d92 /parse.c
parent388b66eb003d3026945992bd48f9180aff8b4f01 (diff)
downloadbfs-5e94b28d4a62cd590f173e0358cb3272073e4585.tar.xz
Fix -daystart to not round 0 upwards.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/parse.c b/parse.c
index 0db2572..4e487dc 100644
--- a/parse.c
+++ b/parse.c
@@ -494,10 +494,13 @@ static struct expr *parse_daystart(struct parser_state *state) {
return NULL;
}
- tm.tm_sec = 0;
- tm.tm_min = 0;
+ if (tm.tm_hour || tm.tm_min || tm.tm_sec || state->now.tv_nsec) {
+ ++tm.tm_mday;
+ }
tm.tm_hour = 0;
- ++tm.tm_mday;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+
time_t time = mktime(&tm);
if (time == -1) {
perror("mktime()");