From 642d32d63f226cd1ba049a9d979132e1a1cef94d Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Tue, 3 Jul 2001 04:21:37 +0000 Subject: cal-client/cal-client.[hc] cal-util/cal-component.c 2001-07-03 Damon Chaplin * cal-client/cal-client.[hc] * cal-util/cal-component.c * cal-util/cal-recur.[hc] * cal-util/test-recur.c * cal-util/timeutil.c * gui/calendar-config.c * gui/calendar-model.[hc] * gui/comp-util.[hc] * gui/e-calendar-table.c * gui/e-day-view-main-item.c * gui/e-day-view-top-item.c * gui/e-day-view.[hc] * gui/e-itip-control.c * gui/e-timezone-entry.[hc] * gui/e-week-view.[hc] * gui/gnome-cal.[hc] * gui/goto.c * gui/tag-calendar.[hc] * gui/dialogs/cal-prefs-dialog.c * gui/dialogs/comp-editor-page.[hc] * gui/dialogs/comp-editor-util.[hc] * gui/dialogs/comp-editor.c * gui/dialogs/e-timezone-dialog.[hc] * gui/dialogs/event-page.c * gui/dialogs/meeting-page.c * gui/dialogs/recurrence-page.c * gui/dialogs/task-details-page.c * gui/dialogs/task-details-page.glade * gui/dialogs/task-page.c * idl/evolution-calendar.idl * pcs/cal-backend-file.c * pcs/cal-backend.c * pcs/cal-backend.h * pcs/cal.c * pcs/query.c: timezone changes everywhere. There's still quite a few things to update, and its not working well at present. svn path=/trunk/; revision=10729 --- calendar/cal-util/timeutil.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'calendar/cal-util/timeutil.c') diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c index 07936950c0..3bb254dbf7 100644 --- a/calendar/cal-util/timeutil.c +++ b/calendar/cal-util/timeutil.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "timeutil.h" @@ -39,8 +40,8 @@ isodate_from_time_t (time_t t) struct tm *tm; char isotime[40]; - tm = localtime (&t); - strftime (isotime, sizeof (isotime)-1, "%Y%m%dT%H%M%S", tm); + tm = gmtime (&t); + strftime (isotime, sizeof (isotime)-1, "%Y%m%dT%H%M%SZ", tm); return g_strdup (isotime); } @@ -51,6 +52,7 @@ isodate_from_time_t (time_t t) * Converts an ISO 8601 time string into a time_t value. * * Return value: Time_t corresponding to the specified ISO string. + * Note that we only allow UTC times at present. **/ time_t time_from_isodate (const char *str) @@ -59,6 +61,7 @@ time_from_isodate (const char *str) struct tm my_tm; time_t t; int i; + char *old_tz; g_return_val_if_fail (str != NULL, -1); @@ -93,16 +96,10 @@ time_from_isodate (const char *str) my_tm.tm_isdst = -1; + old_tz = set_tz ("UTC"); t = mktime (&my_tm); + unset_tz (old_tz); - if (len == 16) { -#if defined(HAVE_TM_GMTOFF) - t += my_tm.tm_gmtoff; -#elif defined(HAVE_TIMEZONE) - t -= timezone; -#endif - } - return t; } -- cgit v1.2.3