diff options
author | Damon Chaplin <damon@ximian.com> | 2001-07-10 10:14:20 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2001-07-10 10:14:20 +0800 |
commit | 8f5df2dc9e38c1396a51595c72a97c1a8de08c9a (patch) | |
tree | 9950edcb3d9655274d9349a8af5ba0fabfc5a483 /libical/src | |
parent | c263befd20deb51e2a27d1e72b9b7d2046b7e5f3 (diff) | |
download | gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.tar gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.tar.gz gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.tar.bz2 gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.tar.lz gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.tar.xz gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.tar.zst gsoc2013-evolution-8f5df2dc9e38c1396a51595c72a97c1a8de08c9a.zip |
if the 2 zones are the same just return.
2001-07-09 Damon Chaplin <damon@ximian.com>
* src/libical/icaltimezone.c (icaltimezone_convert_time): if the 2
zones are the same just return.
* src/libical/icaltime.c (icaltime_adjust): normalize the month.
svn path=/trunk/; revision=10944
Diffstat (limited to 'libical/src')
-rw-r--r-- | libical/src/libical/icaltime.c | 14 | ||||
-rw-r--r-- | libical/src/libical/icaltimezone.c | 13 |
2 files changed, 25 insertions, 2 deletions
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c index 6f6ed5748f..e3229c6925 100644 --- a/libical/src/libical/icaltime.c +++ b/libical/src/libical/icaltime.c @@ -617,6 +617,20 @@ icaltime_adjust (struct icaltimetype *tt, days_overflow--; } + /* Normalize the month. We do this before handling the day since we may + need to know what month it is to get the number of days in it. + Note that months are 1 to 12, so we have to be a bit careful. */ + if (tt->month >= 13) { + years_overflow = (month - 1) / 12; + tt->year += years_overflow; + tt->month -= years_overflow * 12; + } else if (tt->month <= 0) { + /* 0 to -11 is -1 year out, -12 to -23 is -2 years. */ + years_overflow = (month / 12) - 1; + tt->year += years_overflow; + tt->month -= years_overflow * 12; + } + /* Add on the days. */ day = tt->day + days + days_overflow; if (day > 0) { diff --git a/libical/src/libical/icaltimezone.c b/libical/src/libical/icaltimezone.c index def5c1a6fc..5ad77e4171 100644 --- a/libical/src/libical/icaltimezone.c +++ b/libical/src/libical/icaltimezone.c @@ -255,15 +255,21 @@ icaltimezone_get_vtimezone_properties (icaltimezone *zone, icalproperty *prop; const char *tzid, *location; + fprintf (stderr, "In icaltimezone_get_vtimezone_properties\n"); + prop = icalcomponent_get_first_property (component, ICAL_TZID_PROPERTY); if (!prop) return 0; + fprintf (stderr, " found TZID property, getting TZID\n"); + /* A VTIMEZONE MUST have a TZID, or a lot of our code won't work. */ tzid = icalproperty_get_tzid (prop); if (!tzid) return 0; + fprintf (stderr, " found TZID: %s\n", tzid); + zone->tzid = strdup (tzid); zone->component = component; zone->location = icaltimezone_get_location_from_vtimezone (component); @@ -721,8 +727,11 @@ icaltimezone_convert_time (struct icaltimetype *tt, { int utc_offset, is_daylight; - /* First we convert the time to UTC by getting the UTC offset and - subtracting it. */ + /* If both timezones are the same, we don't need to do anything. */ + if (from_zone == to_zone) + return; + + /* Convert the time to UTC by getting the UTC offset and subtracting it. */ utc_offset = icaltimezone_get_utc_offset (from_zone, tt, NULL); icaltime_adjust (tt, 0, 0, 0, -utc_offset); |