void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
int i;
-
time_t now;
struct tm tm_now;
int this_year;
-
time_t tt;
struct tm tm;
-
const int span = 10;
+ int all_day_event = 0;
now = time(NULL);
- memcpy(&tm_now, localtime(&now), sizeof(struct tm));
+ localtime_r(&now, &tm_now);
this_year = tm_now.tm_year + 1900;
if (t == NULL) return;
+ if (t->is_date) all_day_event = 1;
tt = icaltime_as_timet(*t);
- memcpy(&tm, localtime(&tt), sizeof(struct tm));
+ if (all_day_event) {
+ gmtime_r(&tt, &tm);
+ }
+ else {
+ localtime_r(&tt, &tm);
+ }
wprintf("Month: ");
wprintf("<SELECT NAME=\"%s_month\" SIZE=\"1\">\n", prefix);
char vname[SIZ];
tt = time(NULL);
- memcpy(&tm, localtime(&tt), sizeof(struct tm));
+ localtime_r(&tt, &tm);
sprintf(vname, "%s_month", prefix); tm.tm_mon = atoi(bstr(vname)) - 1;
sprintf(vname, "%s_day", prefix); tm.tm_mday = atoi(bstr(vname));
}
-/*
- * Generate a new, globally unique UID parameter for a calendar object.
- */
-void generate_new_uid(char *buf) {
- static int seq = 0;
-
- sprintf(buf, "%ld-%d@%s",
- (long)time(NULL),
- (seq++),
- serv_info.serv_fqdn);
-}
-
/*
* Render a PARTSTAT parameter as a string (and put it in parentheses)
*/