summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index e3257ce..89591b2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -716,11 +716,13 @@ bool eval_fls(const struct bfs_expr *expr, struct bfs_eval *state) {
goto error;
}
char time_str[256];
- const char *time_format = "%b %e %H:%M";
+ size_t time_ret;
if (time <= six_months_ago || time >= tomorrow) {
- time_format = "%b %e %Y";
+ time_ret = strftime(time_str, sizeof(time_str), "%b %e %Y", &tm);
+ } else {
+ time_ret = strftime(time_str, sizeof(time_str), "%b %e %H:%M", &tm);
}
- if (!strftime(time_str, sizeof(time_str), time_format, &tm)) {
+ if (time_ret == 0) {
errno = EOVERFLOW;
goto error;
}