summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2007-03-17 16:43:48 +0000
committerFrederic Culot <calcurse@culot.org>2007-03-17 16:43:48 +0000
commit5d6036f3ae0101b76701dc2413389b43ad7f9b32 (patch)
tree9f3266f9af5f866ac040b07eacfcad6983982434 /src
parent9bc1bc0c4e27e60abad927ca26e5b36bcc456920 (diff)
downloadcalcurse-5d6036f3ae0101b76701dc2413389b43ad7f9b32.tar.gz
calcurse-5d6036f3ae0101b76701dc2413389b43ad7f9b32.zip
date_sec2ical_date(), date_sec2ical_datetime() created
Diffstat (limited to 'src')
-rwxr-xr-xsrc/utils.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index e8181ed..943b355 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.24 2007/03/10 16:45:56 culot Exp $ */
+/* $calcurse: utils.c,v 1.25 2007/03/17 16:43:48 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -494,6 +494,41 @@ char *date_sec2date_str(long sec)
}
/*
+ * Return a string containing an iCal date, given a date in
+ * seconds. This is used to build all-day long iCal VEVENT
+ * (calcurse event equivalent).
+ */
+void
+date_sec2ical_date(long sec, char *ical_date)
+{
+#define DATELENGTH 9
+
+ struct tm *lt;
+ time_t t;
+
+ t = sec;
+ lt = localtime(&t);
+ strftime(ical_date, DATELENGTH, "%Y%m%d", lt);
+}
+
+/*
+ * Return a string containing an iCal date-time, given a date in
+ * seconds. This is used to build iCal VEVENT (calcurse appointment equivalent).
+ */
+void
+date_sec2ical_datetime(long sec, char *ical_datetime)
+{
+#define DATETIMELENGTH 16
+
+ struct tm *lt;
+ time_t t;
+
+ t = sec;
+ lt = localtime(&t);
+ strftime(ical_datetime, DATETIMELENGTH, "%Y%m%dT%H%M%S", lt);
+}
+
+/*
* Return a long containing the date which is updated taking into account
* the new time and date entered by the user.
*/