diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2013-07-17 13:57:11 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2013-07-17 13:57:11 +0200 |
commit | 99b39e5d0dd0f595000bdff35694f96905210ce5 (patch) | |
tree | bc10e8bde63d05b71edc5b732c10bf9d76ab26cc | |
parent | ae93db284edd4f5d90b5d930edfe5770615a316c (diff) | |
download | calcurse-99b39e5d0dd0f595000bdff35694f96905210ce5.tar.gz calcurse-99b39e5d0dd0f595000bdff35694f96905210ce5.zip |
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>
-rw-r--r-- | src/utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
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, |