diff options
author | Chris Toshok <toshok@src.gnome.org> | 2000-04-12 07:40:38 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2000-04-12 07:40:38 +0800 |
commit | d9d1fb83aa965e979c026b83ef912ea6ccc9556a (patch) | |
tree | 5f4e3c16a3b48cbb16cf2aa542a35273ac8c8300 /calendar | |
parent | 8a75c79c81141e7330c824f7441732d7fc158f54 (diff) | |
download | gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.tar gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.tar.gz gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.tar.bz2 gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.tar.lz gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.tar.xz gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.tar.zst gsoc2013-evolution-d9d1fb83aa965e979c026b83ef912ea6ccc9556a.zip |
use HAVE_TIMEZONE to switch between linux's timezone variable and *bsd's
* pcs/icalendar.c (icaltime_to_timet): use HAVE_TIMEZONE to switch
between linux's timezone variable and *bsd's method of getting the
gmt offset.
svn path=/trunk/; revision=2399
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 6 | ||||
-rw-r--r-- | calendar/cal-util/icalendar.c | 15 | ||||
-rw-r--r-- | calendar/pcs/icalendar.c | 15 |
3 files changed, 32 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 6a9100d801..7013db0400 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2000-04-11 Chris Toshok <toshok@helixcode.com> + + * pcs/icalendar.c (icaltime_to_timet): use HAVE_TIMEZONE to switch + between linux's timezone variable and *bsd's method of getting the + gmt offset. + 2000-04-10 Seth Alves <alves@hungry.com> * pcs/cal-backend.c (save_to_vcal): create and save an actual diff --git a/calendar/cal-util/icalendar.c b/calendar/cal-util/icalendar.c index 0a0f39c636..1dcbadc817 100644 --- a/calendar/cal-util/icalendar.c +++ b/calendar/cal-util/icalendar.c @@ -365,7 +365,6 @@ this may not be correct */ static time_t icaltime_to_timet (struct icaltimetype* i) { - extern long timezone; struct tm t; time_t ret; @@ -384,7 +383,19 @@ static time_t icaltime_to_timet (struct icaltimetype* i) ret = mktime(&t); - return ret - (i->is_utc ? timezone : 0); + if (i->is_utc) { +#ifdef HAVE_TIMEZONE + extern long timezone; + ret -= timezone; +#else + struct tm *tmp; + time_t tod = time(NULL); + tmp = localtime (&tod); + ret += tmp->tm_gmtoff; +#endif + } + + return ret; } static iCalPerson* diff --git a/calendar/pcs/icalendar.c b/calendar/pcs/icalendar.c index 0a0f39c636..1dcbadc817 100644 --- a/calendar/pcs/icalendar.c +++ b/calendar/pcs/icalendar.c @@ -365,7 +365,6 @@ this may not be correct */ static time_t icaltime_to_timet (struct icaltimetype* i) { - extern long timezone; struct tm t; time_t ret; @@ -384,7 +383,19 @@ static time_t icaltime_to_timet (struct icaltimetype* i) ret = mktime(&t); - return ret - (i->is_utc ? timezone : 0); + if (i->is_utc) { +#ifdef HAVE_TIMEZONE + extern long timezone; + ret -= timezone; +#else + struct tm *tmp; + time_t tod = time(NULL); + tmp = localtime (&tod); + ret += tmp->tm_gmtoff; +#endif + } + + return ret; } static iCalPerson* |