summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2015-04-10 09:29:17 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2015-04-10 09:42:34 +0200
commitebb811605632a1bfd75c1dadd2edf26950c6966c (patch)
treee13e22434263e684d6c1eaea386dbf48caa24643 /src/utils.c
parent5ac3d43e9af1d901b0db6967999413a6e3364cc5 (diff)
downloadcalcurse-ebb811605632a1bfd75c1dadd2edf26950c6966c.zip
Split out code for drawing week numbers
This allows for easily adding week numbers to other panel modes, such as the monthly view. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c
index f726260..415924a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -363,7 +363,7 @@ int get_item_min(long date)
return lt.tm_min;
}
-time_t date2sec(struct date day, unsigned hour, unsigned min)
+struct tm date2tm(struct date day, unsigned hour, unsigned min)
{
time_t t = now();
struct tm start;
@@ -378,7 +378,14 @@ time_t date2sec(struct date day, unsigned hour, unsigned min)
start.tm_sec = 0;
start.tm_isdst = -1;
- t = mktime(&start);
+ return start;
+}
+
+time_t date2sec(struct date day, unsigned hour, unsigned min)
+{
+ struct tm start = date2tm(day, hour, min);
+ time_t t = mktime(&start);
+
EXIT_IF(t == -1, _("failure in mktime"));
return t;