From: Hib Eris Date: Fri, 16 Jan 2009 09:39:17 +0000 (+0000) Subject: Check for localtime_r. See bug #339172. X-Git-Tag: EVINCE_2_25_5~23 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=93c67e6f3562e68c04c9b08a97cb9a755d7a1782;p=evince.git Check for localtime_r. See bug #339172. 2009-01-16 Hib Eris * configure.ac: * properties/ev-properties-view.c: (ev_properties_view_format_date): Check for localtime_r. See bug #339172. svn path=/trunk/; revision=3339 --- diff --git a/ChangeLog b/ChangeLog index 2455dad5..0ac4a7dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-01-16 Hib Eris + + * configure.ac: + * properties/ev-properties-view.c: + (ev_properties_view_format_date): + + Check for localtime_r. See bug #339172. + 2009-01-16 Hib Eris * shell/main.c: diff --git a/configure.ac b/configure.ac index 5d2c8a37..97ee1b1b 100644 --- a/configure.ac +++ b/configure.ac @@ -405,6 +405,8 @@ if test "x$enable_impress" = "xyes"; then fi AC_SUBST(EVINCE_MIME_TYPES) +AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system])) + AC_CONFIG_FILES([ backend/Makefile backend/comics/Makefile diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c index 6382af4a..12031572 100644 --- a/properties/ev-properties-view.c +++ b/properties/ev-properties-view.c @@ -111,14 +111,19 @@ static char * ev_properties_view_format_date (GTime utime) { time_t time = (time_t) utime; - struct tm t; char s[256]; const char *fmt_hack = "%c"; size_t len; - +#ifdef HAVE_LOCALTIME_R + struct tm t; if (time == 0 || !localtime_r (&time, &t)) return NULL; - len = strftime (s, sizeof (s), fmt_hack, &t); +#else + struct tm *t; + if (time == 0 || !(t = localtime (&time)) ) return NULL; + len = strftime (s, sizeof (s), fmt_hack, t); +#endif + if (len == 0 || s[0] == '\0') return NULL; return g_locale_to_utf8 (s, -1, NULL, NULL, NULL);