Accept 0 time as a shorthand for now to format_expand_time.

This commit is contained in:
nicm
2019-03-14 21:27:26 +00:00
parent 9bd4b96766
commit 1416ceb575
4 changed files with 5 additions and 3 deletions

View File

@ -1482,6 +1482,8 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
if (fmt == NULL || *fmt == '\0')
return (xstrdup(""));
if (t == 0)
t = time(NULL);
tm = localtime(&t);
if (strftime(s, sizeof s, fmt, tm) == 0)