- struct tm tm;
- time_t tm_t;
- struct icaltimetype t2;
-
- /* Stuff tm with zero values */
- memset(&tm, 0, sizeof(struct tm));
-
- /* Convert from string to icaltimetype */
- strptime((char *)BSTR(prefix), "%Y-%m-%d", &tm);
- tm_t = mktime(&tm);
- t2 = icaltime_from_timet(tm_t, 1);
- memcpy(t, &t2, sizeof(struct icaltimetype));
+ if (!t) return;
+
+ /* Stuff with zero values */
+ memset(t, 0, sizeof(struct icaltimetype));
+
+ /* Get the year/month/date all in one shot -- it will be in ISO YYYY-MM-DD format */
+ sscanf((char*)BSTR(prefix), "%04d-%02d-%02d", &t->year, &t->month, &t->day);
+
+ /* time zone is set to the default zone for this server */
+ t->zone = icaltimezone_get_utc_timezone();
+ t->is_date = 1;