From 99b39e5d0dd0f595000bdff35694f96905210ce5 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 17 Jul 2013 13:57:11 +0200 Subject: Allow extended formats for durations Use print_datediff() to print durations. This allows for using something like "%(duration:%EH:%M)". Signed-off-by: Lukas Fleischer --- src/utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 41bebee..3540be8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1325,7 +1325,11 @@ void print_apoint(const char *format, long day, struct apoint *apt) print_date(apt->start, day, extformat); break; case FS_DURATION: - printf("%ld", apt->dur); + /* Backwards compatibility: Use epoch by + * default. */ + if (*extformat == '\0') + strcpy(extformat, "epoch"); + print_datediff(apt->dur, extformat); break; case FS_ENDDATE: print_date(apt->start + apt->dur, day, -- cgit v1.2.3-70-g09d2