Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1823)
+++ ChangeLog	(working copy)
@@ -1,3 +1,17 @@
+2008-09-26  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #360813
+
+	* calendar/e-cal-backend-exchange.h:
+	(e_cal_backend_exchange_ensure_utc_zone):
+	* calendar/e-cal-backend-exchange.c:
+	(e_cal_backend_exchange_ensure_utc_zone):
+	* calendar/e-cal-backend-exchange-tasks.c: (get_changed_tasks),
+	(modify_task_object), (receive_task_objects):
+	* calendar/e-cal-backend-exchange-calendar.c:
+	(modify_object_with_href), (receive_objects):
+	RFC 2445 - CREATED/DTSTAMP/LAST-MODIFIED always in UTC.
+
 2008-09-22  Srinivasa Ragavan  <sragavan@novell.com>
 
 	* configure.in: Version bump for Evolution Exchange 2.25.1
Index: calendar/e-cal-backend-exchange.c
===================================================================
--- calendar/e-cal-backend-exchange.c	(revision 1823)
+++ calendar/e-cal-backend-exchange.c	(working copy)
@@ -595,6 +595,29 @@ find_instance (ECalBackendExchange *cbex
 	return found;
 }
 
+/**
+ * e_cal_backend_exchange_ensure_utc_zone:
+ * Makes sure the given icaltimetype is in UTC, because
+ * RFC 2445 says CREATED/DTSTAMP/LAST-MODIFIED always in UTC.
+ * @param cb ECalbackendExchage descendant.
+ * @param itt What to convert to UTC, if required.
+ **/
+void
+e_cal_backend_exchange_ensure_utc_zone (ECalBackend *cb, struct icaltimetype *itt)
+{
+	g_return_if_fail (cb != NULL);
+	g_return_if_fail (itt != NULL);
+
+	/* RFC 2445 - CREATED/DTSTAMP/LAST-MODIFIED always in UTC */
+	if (!icaltime_is_null_time (*itt) && !icaltime_is_utc (*itt)) {
+		if (!itt->zone)
+			icaltime_set_timezone (itt, e_cal_backend_internal_get_default_timezone (cb));
+
+		icaltimezone_convert_time (itt, (icaltimezone*) icaltime_get_timezone (*itt), icaltimezone_get_utc_timezone ());
+		icaltime_set_timezone (itt, icaltimezone_get_utc_timezone ());
+	}
+}
+
 gboolean
 e_cal_backend_exchange_in_cache (ECalBackendExchange *cbex,
 				 const char          *uid,
Index: calendar/e-cal-backend-exchange-tasks.c
===================================================================
--- calendar/e-cal-backend-exchange-tasks.c	(revision 1823)
+++ calendar/e-cal-backend-exchange-tasks.c	(working copy)
@@ -651,8 +651,10 @@ get_changed_tasks (ECalBackendExchange *
 		e_cal_backend_exchange_add_timezone (cbex, icalcomp);
 
 		itt = icaltime_from_timet (e2k_parse_timestamp (modtime), 0);
-		if (!icaltime_is_null_time (itt))
+		if (!icaltime_is_null_time (itt)) {
+			e_cal_backend_exchange_ensure_utc_zone (E_CAL_BACKEND (cbex), &itt);
 			e_cal_component_set_last_modified (ecal, &itt);
+		}
 
 		/* Set Priority */
 		if ((str = e2k_properties_get_prop (result->props,
@@ -683,6 +685,8 @@ get_changed_tasks (ECalBackendExchange *
 				E2K_PR_HTTPMAIL_DATE))) {
 			itt = icaltime_from_timet (e2k_parse_timestamp (str), 0);
 			if (!icaltime_is_null_time (itt)) {
+				e_cal_backend_exchange_ensure_utc_zone (E_CAL_BACKEND (cbex), &itt);
+
 				e_cal_component_set_dtstamp (
 					E_CAL_COMPONENT (ecal), &itt);
 				e_cal_component_set_created (
@@ -790,8 +794,10 @@ get_changed_tasks (ECalBackendExchange *
 		if ((str = e2k_properties_get_prop (result->props,
 				E2K_PR_CALENDAR_LAST_MODIFIED))) {
 			itt = icaltime_from_timet (e2k_parse_timestamp(str), 0);
-			if (!icaltime_is_null_time (itt))
+			if (!icaltime_is_null_time (itt)) {
+				e_cal_backend_exchange_ensure_utc_zone (E_CAL_BACKEND (cbex), &itt);
 				e_cal_component_set_last_modified (ecal, &itt);
+			}
 		}
 
 		/* Set CATEGORIES */
@@ -1257,7 +1263,7 @@ modify_task_object (ECalBackendSync *bac
         e_cal_component_set_icalcomponent (new_comp, icalcomp);
 
 	/* Set the last modified time on the component */
-        current = icaltime_from_timet (time (NULL), 0);
+        current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
         e_cal_component_set_last_modified (new_comp, &current);
 
 	/* Set Attachments */
@@ -1337,7 +1343,7 @@ receive_task_objects (ECalBackendSync *b
                 ecalcomp = e_cal_component_new ();
                 e_cal_component_set_icalcomponent (ecalcomp, subcomp);
 
-                current = icaltime_from_timet (time (NULL), 0);
+                current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
                 e_cal_component_set_created (ecalcomp, &current);
                 e_cal_component_set_last_modified (ecalcomp, &current);
 
Index: calendar/e-cal-backend-exchange.h
===================================================================
--- calendar/e-cal-backend-exchange.h	(revision 1823)
+++ calendar/e-cal-backend-exchange.h	(working copy)
@@ -112,6 +112,7 @@ gchar *e_cal_backend_exchange_get_owner_
 gchar *e_cal_backend_exchange_get_owner_name (ECalBackendSync *backend);
 void e_cal_backend_exchange_cache_lock (ECalBackendExchange *cbex);
 void e_cal_backend_exchange_cache_unlock (ECalBackendExchange *cbex) ;
+void e_cal_backend_exchange_ensure_utc_zone (ECalBackend *cb, struct icaltimetype *itt);
 
 G_END_DECLS
 
Index: calendar/e-cal-backend-exchange-calendar.c
===================================================================
--- calendar/e-cal-backend-exchange-calendar.c	(revision 1823)
+++ calendar/e-cal-backend-exchange-calendar.c	(working copy)
@@ -1193,7 +1193,7 @@ modify_object_with_href (ECalBackendSync
 
 	update_x_properties (E_CAL_BACKEND_EXCHANGE (cbexc), updated_ecomp);
 
-	last_modified = icaltime_from_timet (time (NULL), 0);
+	last_modified = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
 	e_cal_component_set_last_modified (updated_ecomp, &last_modified);
 
 	if (e_cal_component_has_attachments (updated_ecomp)) {
@@ -1631,7 +1631,7 @@ receive_objects (ECalBackendSync *backen
 		e_cal_component_set_icalcomponent (comp, subcomp);
 
 		/*create time and last modified*/
-		current = icaltime_from_timet (time (NULL), 0);
+		current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
 		e_cal_component_set_created (comp, &current);
 		e_cal_component_set_last_modified (comp, &current);
 
