changeset 3161:1fde0667976e

[gaim-migrate @ 3177] Now EVERYBODY can compile! Whee! committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 21 Apr 2002 22:08:41 +0000
parents 09e342b27eff
children 7dfd1871c39d
files acconfig.h configure.ac src/protocols/jabber/jabber.c
diffstat 3 files changed, 42 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/acconfig.h	Sun Apr 21 19:05:29 2002 +0000
+++ b/acconfig.h	Sun Apr 21 22:08:41 2002 +0000
@@ -23,3 +23,5 @@
 #undef STATIC_PROTO_INIT
 #endif
 #undef socklen_t
+#undef HAVE_TM_GMTOFF
+#undef HAVE_TIMEZONE
--- a/configure.ac	Sun Apr 21 19:05:29 2002 +0000
+++ b/configure.ac	Sun Apr 21 22:08:41 2002 +0000
@@ -256,6 +256,35 @@
 AC_SUBST(XSS_LIBS)
 
 
+dnl Shamelessly stolen from gnome-pim
+dnl This determines, if struct tm containes tm_gmtoff field
+dnl or we should use extern long int timezone.
+dnl Actually this should go into acinclude.m4
+AC_DEFUN(GC_TIMEZONE,
+[AC_REQUIRE([AC_STRUCT_TM])dnl
+AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
+  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_CACHE_CHECK(for timezone, ac_cv_var_timezone,
+[AC_TRY_LINK(
+changequote(<<, >>)dnl
+<<#include <time.h>
+extern long int timezone;>>,
+changequote([, ])dnl
+[long int l = timezone;], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
+  if test $ac_cv_var_timezone = yes; then
+    AC_DEFINE(HAVE_TIMEZONE)
+  fi
+fi
+])
+
+GC_TIMEZONE
+
+
 
 dnl This was taken straight from X-Chat.
 dnl X-Chat is the greatest application ever, not only
--- a/src/protocols/jabber/jabber.c	Sun Apr 21 19:05:29 2002 +0000
+++ b/src/protocols/jabber/jabber.c	Sun Apr 21 22:08:41 2002 +0000
@@ -738,7 +738,17 @@
    {
       t.tm_year -= 1900;
       t.tm_mon -= 1;
-      return mktime(&t) - t.tm_gmtoff;
+      return mktime(&t) +
+#ifdef HAVE_TM_GMTOFF
+	      t.tm_gmtoff
+#else
+#     ifdef HAVE_TIMEZONE
+	      timezone
+#     else
+	      0
+#     endif
+#endif
+	      ;
    }
    return 0;
 }