From 4e80c5ec0ac6a9a1e441288dfe341be17f71e800 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Wed, 27 Aug 2003 16:45:56 +0000 Subject: Fix a problem where the timezone would reset to UTC when switching views. Thanks to William Bloom for finding the catalyst that causes this. PR: 55409 Obtained from: libical-0.24 --- mail/evolution/Makefile | 1 + .../files/patch-libical_src_libical_icaltime.c | 106 +++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 mail/evolution/files/patch-libical_src_libical_icaltime.c (limited to 'mail') diff --git a/mail/evolution/Makefile b/mail/evolution/Makefile index 9efdee5760d5..88c07dc74e09 100644 --- a/mail/evolution/Makefile +++ b/mail/evolution/Makefile @@ -7,6 +7,7 @@ PORTNAME= evolution PORTVERSION= 1.4.4 +PORTREVISION= 1 CATEGORIES= mail gnome MASTER_SITES= ${MASTER_SITE_GNOME} \ http://people.FreeBSD.org/~sobomax/:local diff --git a/mail/evolution/files/patch-libical_src_libical_icaltime.c b/mail/evolution/files/patch-libical_src_libical_icaltime.c new file mode 100644 index 000000000000..6f24e0f4cbf4 --- /dev/null +++ b/mail/evolution/files/patch-libical_src_libical_icaltime.c @@ -0,0 +1,106 @@ +--- libical/src/libical/icaltime.c.orig Tue Aug 26 20:25:02 2003 ++++ libical/src/libical/icaltime.c Tue Aug 26 20:29:05 2003 +@@ -46,6 +46,76 @@ + + #include "icaltimezone.h" + ++static time_t make_time(struct tm *tm, int tzm) ++{ ++ time_t tim; ++ ++ static int days[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }; ++ ++ /* check that year specification within range */ ++ ++ if (tm->tm_year < 70 || tm->tm_year > 138) ++ return((time_t) -1); ++ ++ /* check that month specification within range */ ++ ++ if (tm->tm_mon < 0 || tm->tm_mon > 11) ++ return((time_t) -1); ++ ++ /* check for upper bound of Jan 17, 2038 (to avoid possibility of ++ 32-bit arithmetic overflow) */ ++ ++ if (tm->tm_year == 138) { ++ if (tm->tm_mon > 0) ++ return((time_t) -1); ++ else if (tm->tm_mday > 17) ++ return((time_t) -1); ++ } ++ ++ /* ++ * calculate elapsed days since start of the epoch (midnight Jan ++ * 1st, 1970 UTC) 17 = number of leap years between 1900 and 1970 ++ * (number of leap days to subtract) ++ */ ++ ++ tim = (tm->tm_year - 70) * 365 + ((tm->tm_year - 1) / 4) - 17; ++ ++ /* add number of days elapsed in the current year */ ++ ++ tim += days[tm->tm_mon]; ++ ++ /* check and adjust for leap years (the leap year check only valid ++ during the 32-bit era */ ++ ++ if ((tm->tm_year & 3) == 0 && tm->tm_mon > 1) ++ tim += 1; ++ ++ /* elapsed days to current date */ ++ ++ tim += tm->tm_mday; ++ ++ ++ /* calculate elapsed hours since start of the epoch */ ++ ++ tim = tim * 24 + tm->tm_hour; ++ ++ /* calculate elapsed minutes since start of the epoch */ ++ ++ tim = tim * 60 + tm->tm_min; ++ ++ /* adjust per time zone specification */ ++ ++ tim -= tzm; ++ ++ /* calculate elapsed seconds since start of the epoch */ ++ ++ tim = tim * 60 + tm->tm_sec; ++ ++ /* return number of seconds since start of the epoch */ ++ ++ return(tim); ++} ++ + + struct icaltimetype + icaltime_from_timet(time_t tm, int is_date) +@@ -221,13 +291,7 @@ + stm.tm_year = tt.year-1900; + stm.tm_isdst = -1; + +- if(tt.is_utc == 1 || tt.is_date == 1){ +- char *old_tz = set_tz("UTC"); +- t = mktime(&stm); +- unset_tz(old_tz); +- } else { +- t = mktime(&stm); +- } ++ t = make_time(&stm, 0); + + return t; + +@@ -269,10 +333,7 @@ + stm.tm_year = tt.year-1900; + stm.tm_isdst = -1; + +- /* Set TZ to UTC and use mktime to convert to a time_t. */ +- old_tz = set_tz ("UTC"); +- t = mktime (&stm); +- unset_tz (old_tz); ++ t = make_time(&stm, 0); + + return t; + } -- cgit v1.2.3