aboutsummaryrefslogtreecommitdiffstats
path: root/src/apoint.c
diff options
context:
space:
mode:
authormercurialmoon <mercurialmoon@protonmail.com>2020-12-23 19:15:05 -0800
committerLukas Fleischer <lfleischer@calcurse.org>2021-04-11 19:52:02 -0400
commita49adf2db7cfb3e4b12fed948c76205a42f334cd (patch)
tree1a946cfa330bbdfb0a4622d5b9cf647b7162d7ba /src/apoint.c
parent9b148900b87b113bc9f30033eff30865a3b43086 (diff)
downloadcalcurse-a49adf2db7cfb3e4b12fed948c76205a42f334cd.tar.gz
calcurse-a49adf2db7cfb3e4b12fed948c76205a42f334cd.zip
Allow configuration of appointment time format
Added the option to configure the format in which appointment time is displayed. The setting is called "format.appointmenttime" under the general settings menu. Setting defaults to previous behavior, which was "%H:%M". Signed-off-by: mercurialmoon <mercurialmoon@protonmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/apoint.c')
-rw-r--r--src/apoint.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/apoint.c b/src/apoint.c
index 4cb77f6..b4e8f2e 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -42,6 +42,8 @@
#include "calcurse.h"
#include "sha1.h"
+#define APPT_TIME_LENGTH 25
+
llist_ts_t alist_p;
void apoint_free(struct apoint *apt)
@@ -134,16 +136,14 @@ void apoint_sec2str(struct apoint *o, time_t day, char *start, char *end)
} else {
t = o->start;
localtime_r(&t, &lt);
- snprintf(start, HRMIN_SIZE, "%02u:%02u", lt.tm_hour,
- lt.tm_min);
+ strftime(start, APPT_TIME_LENGTH, conf.timefmt, &lt);
}
if (o->start + o->dur > day + DAYLEN(day)) {
strncpy(end, "..:..", 6);
} else {
t = o->start + o->dur;
localtime_r(&t, &lt);
- snprintf(end, HRMIN_SIZE, "%02u:%02u", lt.tm_hour,
- lt.tm_min);
+ strftime(end, APPT_TIME_LENGTH, conf.timefmt, &lt);
}
}