aboutsummaryrefslogtreecommitdiffstats
path: root/libical
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-12-13 06:54:41 +0800
committerDan Winship <danw@src.gnome.org>2000-12-13 06:54:41 +0800
commit9195d5465ee135ac9451f836d1075bdcd7cac8c2 (patch)
tree70feb020f5f23f9c6d8e10195625de34b51f8f59 /libical
parentb03dcd755230c2b6cb896963977f2537ed50b2a4 (diff)
downloadgsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.tar
gsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.tar.gz
gsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.tar.bz2
gsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.tar.lz
gsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.tar.xz
gsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.tar.zst
gsoc2013-evolution-9195d5465ee135ac9451f836d1075bdcd7cac8c2.zip
Add a check for "extern int timezone;" vs struct tm tm_gmtoff, stolen from
* configure.in: Add a check for "extern int timezone;" vs struct tm tm_gmtoff, stolen from Evolution's configure.in. * src/libical/icaltime.c (icaltime_utc_offset, icaltime_local_utc_offset): Use HAVE_TIMEZONE, add tm_gmtoff support. * src/libical/icallexer.l: Remove ical_yy_scan_buffer, ..._string, and ..._bytes prototypes, since it compiles fine without them on Linux, and bombs out due to prototype mismatch on my NetBSD box. svn path=/trunk/; revision=6945
Diffstat (limited to 'libical')
-rw-r--r--libical/ChangeLog13
-rw-r--r--libical/acconfig.h6
-rw-r--r--libical/configure.in23
-rw-r--r--libical/src/libical/icallexer.l8
-rw-r--r--libical/src/libical/icaltime.c11
5 files changed, 53 insertions, 8 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 43b9547fc9..6f3a048ece 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,16 @@
+2000-12-12 Dan Winship <danw@helixcode.com>
+
+ * configure.in: Add a check for "extern int timezone;" vs struct
+ tm tm_gmtoff, stolen from Evolution's configure.in.
+
+ * src/libical/icaltime.c (icaltime_utc_offset,
+ icaltime_local_utc_offset): Use HAVE_TIMEZONE, add tm_gmtoff
+ support.
+
+ * src/libical/icallexer.l: Remove ical_yy_scan_buffer, ..._string,
+ and ..._bytes prototypes, since it compiles fine without them on
+ Linux, and bombs out due to prototype mismatch on my NetBSD box.
+
2000-12-11 Federico Mena Quintero <federico@helixcode.com>
* Makefile.am:
diff --git a/libical/acconfig.h b/libical/acconfig.h
index ede59fd497..96f0975b26 100644
--- a/libical/acconfig.h
+++ b/libical/acconfig.h
@@ -8,3 +8,9 @@
/* Define to terminate lines with "\n" instead of "\r\n" */
#undef ICAL_UNIX_NEWLINE
+
+/* Define if your libc defines a "timezone" variable
+#undef HAVE_TIMEZONE
+
+/* Define if your libc defines a struct tm containing a "tm_gmtoff" member */
+#undef HAVE_TM_GMTOFF
diff --git a/libical/configure.in b/libical/configure.in
index 4413519481..3ce77c6ca5 100644
--- a/libical/configure.in
+++ b/libical/configure.in
@@ -36,6 +36,29 @@ AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
+AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
+ AC_TRY_COMPILE([
+ #include <time.h>
+ ], [
+ timezone = 1;
+ ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
+if test $ac_cv_var_timezone = yes; then
+ AC_DEFINE(HAVE_TIMEZONE)
+else
+ AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
+ AC_TRY_COMPILE([
+ #include <time.h>
+ ], [
+ struct tm tm;
+ tm.tm_gmtoff = 1;
+ ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
+ if test $ac_cv_struct_tm_gmtoff = yes; then
+ AC_DEFINE(HAVE_TM_GMTOFF)
+ else
+ AC_ERROR(unable to find a way to determine timezone)
+ fi
+fi
+
dnl Checks for library functions.
AC_CHECK_FUNCS(strdup)
diff --git a/libical/src/libical/icallexer.l b/libical/src/libical/icallexer.l
index 4ac847b064..5a3616b8da 100644
--- a/libical/src/libical/icallexer.l
+++ b/libical/src/libical/icallexer.l
@@ -6,7 +6,7 @@
DESCRIPTION:
- $Id: icallexer.l,v 1.6 2000/12/12 00:27:39 federico Exp $
+ $Id: icallexer.l,v 1.7 2000/12/12 22:54:40 danw Exp $
$Locker: $
(C) COPYRIGHT 1999 Eric Busboom
@@ -63,12 +63,6 @@ char *str_buf;
char *str_buf_p;
size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
-/* Define routines that were not propertly defined because of the
-renaming hack applied in icalyacc.y */
-YY_BUFFER_STATE ical_yy_scan_buffer ( char *base, yy_size_t size );
-YY_BUFFER_STATE ical_yy_scan_string ( yyconst char *yy_str );
-YY_BUFFER_STATE ical_yy_scan_bytes ( yyconst char *bytes, int len );
-
%}
crlf \x0D?\x0A
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c
index f43602a721..3a762a73f9 100644
--- a/libical/src/libical/icaltime.c
+++ b/libical/src/libical/icaltime.c
@@ -284,7 +284,9 @@ struct icaltimetype icaltime_as_zone(struct icaltimetype tt,const char* tzid)
indicating the date for which you want the offset */
time_t icaltime_utc_offset(struct icaltimetype tt, const char* tzid)
{
+#ifdef HAVE_TIMEZONE
extern long int timezone;
+#endif
time_t now;
struct tm *stm;
@@ -315,7 +317,11 @@ time_t icaltime_utc_offset(struct icaltimetype tt, const char* tzid)
putenv("TZ"); /* Delete from environment */
}
+#ifdef HAVE_TIMEZONE
return timezone;
+#else
+ return -stm->tm_gmtoff;
+#endif
}
time_t icaltime_local_utc_offset()
@@ -325,8 +331,11 @@ time_t icaltime_local_utc_offset()
stm = localtime(&now); /* This sets 'timezone'*/
+#ifdef HAVE_TIMEZONE
return timezone;
-
+#else
+ return -stm->tm_gmtoff;
+#endif
}