[evolution-data-server] 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] Get the prototype for strptime() when it's available
- Date: Fri, 18 Dec 2009 13:26:00 +0000 (UTC)
commit 269be6df490556db6237fe4a6bac35b2aa5916f7
Author: Emilio Pozuelo Monfort <pochu27 gmail com>
Date: Fri Dec 18 14:03:50 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 f6e449c..ae9f70a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,7 +269,7 @@ AC_FUNC_ALLOCA
dnl ******************************
dnl Checks for functions
dnl ******************************
-AC_CHECK_FUNCS(fsync strptime strtok_r)
+AC_CHECK_FUNCS(fsync strptime strtok_r nl_langinfo)
dnl ***********************************
dnl Check for base dependencies early.
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index 73759c5..e3b731f 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]