]> git.notmuchmail.org Git - notmuch/blobdiff - parse-time-string/parse-time-string.c
parse-time-string: fix setting and rounding of seconds
[notmuch] / parse-time-string / parse-time-string.c
index 584067d33d6f1cb61039f1859c5e511b2a57f95e..1cef47d4b0bd85faafe8fdd1cff5ad368d56459c 100644 (file)
@@ -32,6 +32,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 
+#include "compat.h"
 #include "parse-time-string.h"
 
 /*
@@ -1080,10 +1081,10 @@ parse_time (struct state *state, char sep,
        return set_user_tz (state, state->delim, v1, v2);
     }
 
-    if (!is_valid_time (v1, v2, v3))
+    if (!is_valid_time (v1, v2, n3 ? v3 : 0))
        return -PARSE_TIME_ERR_INVALIDTIME;
 
-    return set_abs_time (state, v1, v2, n3 ? v3 : 0);
+    return set_abs_time (state, v1, v2, n3 ? (int) v3 : UNSET);
 }
 
 /* strtoul helper that assigns length. */