[evolution-data-server/gnome-2-28] Get the prototype for strptime() when it's available
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-28] Get the prototype for strptime() when it's available
- Date: Fri, 18 Dec 2009 12:57:29 +0000 (UTC)
commit c0237dffc84cc094e0abc5cf1d14044f1b81f883
Author: Emilio Pozuelo Monfort <pochu27 gmail com>
Date: Fri Dec 18 12:00:56 2009 +0100
Get the prototype for strptime() when it's available
Instead of only getting it on Linux. Also use nl_langinfo()
when available, and not only on Linux.
Define _BSD_SOURCE for tm_gmtoff now that we don't define
_GNU_SOURCE.
configure.ac | 2 +-
libedataserver/e-time-utils.c | 14 ++++++--------
2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f9ea656..dcaf10a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -261,7 +261,7 @@ dnl Check for posix compatible alloca()
AC_FUNC_ALLOCA
dnl Checks for functions
-AC_CHECK_FUNCS(fsync strptime strtok_r)
+AC_CHECK_FUNCS(fsync strptime strtok_r nl_langinfo)
dnl Check for base dependencies early.
PKG_CHECK_MODULES(GNOME_PLATFORM,
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index 75c2f1d..dc9d06a 100644
--- a/libedataserver/e-time-utils.c
+++ b/libedataserver/e-time-utils.c
@@ -9,19 +9,17 @@
*/
#include <config.h>
+#define _XOPEN_SOURCE
-#ifdef __linux__
-/* We need this to get a prototype for strptime. */
-#define _GNU_SOURCE
-#endif /* __linux__ */
+/* For tm_gmtoff */
+#define _BSD_SOURCE
#include <time.h>
#include <sys/time.h>
-#ifdef __linux__
+#ifdef HAVE_NL_LANGINFO
#include <langinfo.h>
-#undef _GNU_SOURCE
-#endif /* __linux__ */
+#endif /* HAVE_NL_LANGINFO */
#include <string.h>
#include <ctype.h>
@@ -2028,7 +2026,7 @@ e_time_get_d_fmt_with_4digit_year (void)
{
gchar *p;
gchar *res = NULL;
-#if defined(__linux__)
+#if defined(HAVE_NL_LANGINFO)
res = g_strdup (nl_langinfo (D_FMT) );
#elif defined(G_OS_WIN32)
#define GET_LOCALE_INFO(str, len) GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, str, len)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]