summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 8bd72e6..c04c0a6 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -408,6 +408,19 @@ time_t date2sec(struct date day, unsigned hour, unsigned min)
return t;
}
+/* Return the (calcurse) date of a (Unix) time in seconds. */
+struct date sec2date(time_t t)
+{
+ struct tm tm;
+ struct date d;
+
+ localtime_r(&t, &tm);
+ d.dd = tm.tm_mday;
+ d.mm = tm.tm_mon + 1;
+ d.yyyy = tm.tm_year + 1900;
+ return d;
+}
+
time_t utcdate2sec(struct date day, unsigned hour, unsigned min)
{
char *tz;