diff options
author | Jérôme Pinot <ngc891@gmail.com> | 2011-12-10 22:32:35 +0900 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-12-16 15:12:17 +0100 |
commit | 9a85b790aab1611a7c9105d08fb6be1500ed82f7 (patch) | |
tree | 15c2184243bf2bf9a6cc5fbc08ac5dd26d17dba0 | |
parent | 5e4db62662a40fd73c911218a79bb984dc169b18 (diff) | |
download | calcurse-9a85b790aab1611a7c9105d08fb6be1500ed82f7.tar.gz calcurse-9a85b790aab1611a7c9105d08fb6be1500ed82f7.zip |
Format "DURATION" field properly on ical export
Use days/hours/minutes/seconds instead of seconds in the DURATION field.
It fixes interaction with other softwares like phpicalendar.
Lukas: Remove use of dur-week. RFC 5545 states that you cannot use this
in conjunction with dur-day. Also, fix formatting and use proper
constants.
Signed-off-by: Jerome Pinot <ngc891@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | src/io.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -622,7 +622,11 @@ ical_export_apoints (FILE *stream) date_sec2date_fmt (apt->start, ICALDATETIMEFMT, ical_datetime); (void)fprintf (stream, "BEGIN:VEVENT\n"); (void)fprintf (stream, "DTSTART:%s\n", ical_datetime); - (void)fprintf (stream, "DURATION:PT0H0M%ldS\n", apt->dur); + (void)fprintf (stream, "DURATION:P%ldDT%ldH%ldM%ldS\n", + apt->dur / DAYINSEC, + (apt->dur / HOURINSEC) % 24, + (apt->dur / MININSEC) % 60, + apt->dur % MININSEC); (void)fprintf (stream, "SUMMARY:%s\n", apt->mesg); if (apt->state & APOINT_NOTIFY) ical_export_valarm (stream); |