diff options
author | JP Rosevear <jpr@ximian.com> | 2001-10-24 01:40:55 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-10-24 01:40:55 +0800 |
commit | 31675e8d99ca20c77f322f69bccc8eb64e4ca63e (patch) | |
tree | 38f83373eb1fae8436c68f669d0a1e28d0e7a656 /calendar/conduits/todo | |
parent | 2ea98fb813283a72698682e3f51f3ae13b614889 (diff) | |
download | gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.tar gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.tar.gz gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.tar.bz2 gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.tar.lz gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.tar.xz gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.tar.zst gsoc2013-evolution-31675e8d99ca20c77f322f69bccc8eb64e4ca63e.zip |
convert an icaltimetype to a tm (tm_to_icaltimetype): vice versa
2001-10-23 JP Rosevear <jpr@ximian.com>
* cal-util/timeutil.c (icaltimetype_to_tm): convert an
icaltimetype to a tm
(tm_to_icaltimetype): vice versa
* cal-util/timeutil.h: new protos
* conduits/calendar/calendar-conduit.c: replace all mktime and
localtime calls (except for debugging calls)
* conduits/todo/todo-conduit.c: ditto
(comp_from_remote_record): make sure the completed time is in UTC
svn path=/trunk/; revision=13946
Diffstat (limited to 'calendar/conduits/todo')
-rw-r--r-- | calendar/conduits/todo/todo-conduit.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index ca59b04bd6..ed039b10b7 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -364,9 +364,9 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui GSList *d_list = NULL; CalComponentText *description; CalComponentDateTime due; - time_t due_time; CalComponentClassification classif; - + icaltimezone *default_tz = get_default_timezone (); + LOG ("local_record_from_comp\n"); g_return_if_fail (local != NULL); @@ -417,9 +417,10 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui cal_component_get_due (comp, &due); if (due.value) { - due_time = icaltime_as_timet_with_zone (*due.value, get_timezone (ctxt->client, due.tzid)); - - local->todo->due = *localtime (&due_time); + icaltimezone_convert_time (due.value, + get_timezone (ctxt->client, due.tzid), + default_tz); + local->todo->due = icaltimetype_to_tm (due.value); local->todo->indefinite = 0; } else { local->todo->indefinite = 1; @@ -493,10 +494,10 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, { CalComponent *comp; struct ToDo todo; - struct icaltimetype now = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone); CalComponentText summary = {NULL, NULL}; CalComponentDateTime dt = {NULL, icaltimezone_get_tzid (timezone)}; - struct icaltimetype due; + struct icaltimetype due, now; + icaltimezone *utc_zone; int priority; char *txt; @@ -505,6 +506,10 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, memset (&todo, 0, sizeof (struct ToDo)); unpack_ToDo (&todo, remote->record, remote->length); + utc_zone = icaltimezone_get_utc_timezone (); + now = icaltime_from_timet_with_zone (time (NULL), FALSE, + utc_zone); + if (in_comp == NULL) { comp = cal_component_new (); cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); @@ -537,12 +542,13 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, if (todo.complete) { int percent = 100; + cal_component_set_completed (comp, &now); cal_component_set_percent (comp, &percent); } if (!is_empty_time (todo.due)) { - due = icaltime_from_timet_with_zone (mktime (&todo.due), FALSE, timezone); + due = tm_to_icaltimetype (&todo.due, FALSE); dt.value = &due; cal_component_set_due (comp, &dt); } |