From d80bc917c0df90ab7e5698ff6926febbb9d9b8a8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 20 Nov 2008 22:33:24 +0000 Subject: [PATCH] Saving events from a web form now uses icaltime_from_timet_with_zone(). This did not have the effect that I thought it would. It's converting to UTC, which results in the correct time being used, but I wanted the timezone to be attached as a parameter so a reader would convert it on the fly. --- webcit/calendar_tools.c | 22 ++++++++++++++++------ webcit/event.c | 3 --- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index a2d23b4fb..cbcda4362 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -118,13 +118,13 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int d } /* - * Get time from form - * get the time back from the user and convert it into internal structs. + * Get date/time from a web form and convert it into an icaltimetype struct. */ void icaltime_from_webform(struct icaltimetype *t, char *prefix) { char datebuf[32]; char vname[32]; struct tm tm; + /* Stuff tm with some zero values */ tm.tm_year = 0; tm.tm_sec = 0; @@ -134,23 +134,33 @@ void icaltime_from_webform(struct icaltimetype *t, char *prefix) { tm.tm_mon = 0; int hour = 0; int minute = 0; + struct icaltimetype t2; - strptime((char*)BSTR(prefix), "%Y-%m-%d", &tm); sprintf(vname, "%s_hour", prefix); hour = IBSTR(vname); sprintf(vname, "%s_minute", prefix); minute = IBSTR(vname); tm.tm_hour = hour; tm.tm_min = minute; strftime(&datebuf[0], 32, "%Y%m%dT%H%M%S", &tm); - t2 = icaltime_from_string(datebuf); + + /* old + * t2 = icaltime_from_string(datebuf); + */ + + /* unavailable + * t2 = icaltime_from_string_with_zone(datebuf, get_default_icaltimezone() ); + */ + + /* new */ + t2 = icaltime_from_timet_with_zone(mktime(&tm), 0, get_default_icaltimezone()); + memcpy(t, &t2, sizeof(struct icaltimetype)); } /* - * Get time from form - * get the time back from the user and convert it into internal structs. + * Get date (no time) from a web form and convert it into an icaltimetype struct. */ void icaltime_from_webform_dateonly(struct icaltimetype *t, char *prefix) { struct tm tm; diff --git a/webcit/event.c b/webcit/event.c index fb72422d0..f1af019db 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -582,9 +582,6 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, int rrymweek = rrmweek; int rrymweekday = rrmweekday; int rrymonth = t_start.month; - - lprintf(9, "FIXME: RRYMWEEK %d, RRYMWEEKDAY %d, RRYMONTH %d\n", rrymweek, rrymweekday, rrymonth); - int which_rryeartype_is_preselected = 0; if ( (recur.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) -- 2.30.2