From cf83cd0a5911736492441365216a4aa9e72727f4 Mon Sep 17 00:00:00 2001 From: shugo Date: Wed, 20 Aug 2008 17:08:36 +0000 Subject: * configure.in: always check timezone(). * strftime.c (rb_strftime): prefer timezone/altzone rather than gettimeofday(). The second argument to gettimeofday() is ignored on Solaris. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ configure.in | 22 ++++++++++------------ strftime.c | 10 +++++----- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index c49412560..c85a37699 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Aug 21 01:58:59 2008 Shugo Maeda + + * configure.in: always check timezone(). + + * strftime.c (rb_strftime): prefer timezone/altzone rather than + gettimeofday(). The second argument to gettimeofday() is ignored + on Solaris. + Thu Aug 21 02:03:08 2008 Tanaka Akira * io.c (open_key_args): simplified. diff --git a/configure.in b/configure.in index 0cdc09e21..c05289e14 100644 --- a/configure.in +++ b/configure.in @@ -886,18 +886,16 @@ if test "[$rb_cv_var_]$1" != no; then fi]) RUBY_CHECK_VARTYPE(timezone, [@%:@include ], [long int]) RUBY_CHECK_VARTYPE(altzone, [@%:@include ], [long int]) -if test "$rb_cv_var_timezone" = no; then - AC_CHECK_FUNCS(timezone) - if test "$ac_cv_func_timezone" = yes; then - AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void, - [AC_TRY_COMPILE([@%:@include ], - [(void)timezone(0, 0);], - [rb_cv_func_timezone_void=no], - [rb_cv_func_timezone_void=yes])] - ) - if test $rb_cv_func_timezone_void = yes; then - AC_DEFINE(TIMEZONE_VOID) - fi +AC_CHECK_FUNCS(timezone) +if test "$ac_cv_func_timezone" = yes; then + AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void, + [AC_TRY_COMPILE([@%:@include ], + [(void)timezone(0, 0);], + [rb_cv_func_timezone_void=no], + [rb_cv_func_timezone_void=yes])] + ) + if test $rb_cv_func_timezone_void = yes; then + AC_DEFINE(TIMEZONE_VOID) fi fi diff --git a/strftime.c b/strftime.c index f2cfea69e..86284191c 100644 --- a/strftime.c +++ b/strftime.c @@ -420,18 +420,18 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept */ off = timeptr->tm_gmtoff / 60; #else /* !HAVE_TM_ZONE */ -#ifdef HAVE_GETTIMEOFDAY - gettimeofday(&tv, &zone); - off = -zone.tz_minuteswest; -#else #if HAVE_VAR_TIMEZONE #if HAVE_VAR_ALTZONE off = -(daylight ? timezone : altzone) / 60; #else off = -timezone / 60; #endif +#else /* !HAVE_TIMEZONE */ +#ifdef HAVE_GETTIMEOFDAY + gettimeofday(&tv, &zone); + off = -zone.tz_minuteswest; #endif -#endif +#endif /* !HAVE_TIMEZONE */ #endif /* !HAVE_TM_ZONE */ #endif /* !HAVE_TM_NAME */ if (off < 0) { -- cgit