summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2013-07-17 13:57:11 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2013-07-17 13:57:11 +0200
commit99b39e5d0dd0f595000bdff35694f96905210ce5 (patch)
treebc10e8bde63d05b71edc5b732c10bf9d76ab26cc /src
parentae93db284edd4f5d90b5d930edfe5770615a316c (diff)
downloadcalcurse-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>
Diffstat (limited to 'src')
-rw-r--r--src/utils.c6
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,