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 <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2013-07-17 13:57:11 +02:00
parent ae93db284e
commit 99b39e5d0d

View File

@ -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,