* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
19569c8f25
commit
65337c5b2d
@ -1,3 +1,11 @@
|
|||||||
|
Thu Aug 21 01:58:59 2008 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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 <akr@fsij.org>
|
Thu Aug 21 02:03:08 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* io.c (open_key_args): simplified.
|
* io.c (open_key_args): simplified.
|
||||||
|
22
configure.in
22
configure.in
@ -886,18 +886,16 @@ if test "[$rb_cv_var_]$1" != no; then
|
|||||||
fi])
|
fi])
|
||||||
RUBY_CHECK_VARTYPE(timezone, [@%:@include <time.h>], [long int])
|
RUBY_CHECK_VARTYPE(timezone, [@%:@include <time.h>], [long int])
|
||||||
RUBY_CHECK_VARTYPE(altzone, [@%:@include <time.h>], [long int])
|
RUBY_CHECK_VARTYPE(altzone, [@%:@include <time.h>], [long int])
|
||||||
if test "$rb_cv_var_timezone" = no; then
|
AC_CHECK_FUNCS(timezone)
|
||||||
AC_CHECK_FUNCS(timezone)
|
if test "$ac_cv_func_timezone" = yes; then
|
||||||
if test "$ac_cv_func_timezone" = yes; then
|
AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void,
|
||||||
AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void,
|
[AC_TRY_COMPILE([@%:@include <time.h>],
|
||||||
[AC_TRY_COMPILE([@%:@include <time.h>],
|
[(void)timezone(0, 0);],
|
||||||
[(void)timezone(0, 0);],
|
[rb_cv_func_timezone_void=no],
|
||||||
[rb_cv_func_timezone_void=no],
|
[rb_cv_func_timezone_void=yes])]
|
||||||
[rb_cv_func_timezone_void=yes])]
|
)
|
||||||
)
|
if test $rb_cv_func_timezone_void = yes; then
|
||||||
if test $rb_cv_func_timezone_void = yes; then
|
AC_DEFINE(TIMEZONE_VOID)
|
||||||
AC_DEFINE(TIMEZONE_VOID)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
10
strftime.c
10
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;
|
off = timeptr->tm_gmtoff / 60;
|
||||||
#else /* !HAVE_TM_ZONE */
|
#else /* !HAVE_TM_ZONE */
|
||||||
#ifdef HAVE_GETTIMEOFDAY
|
|
||||||
gettimeofday(&tv, &zone);
|
|
||||||
off = -zone.tz_minuteswest;
|
|
||||||
#else
|
|
||||||
#if HAVE_VAR_TIMEZONE
|
#if HAVE_VAR_TIMEZONE
|
||||||
#if HAVE_VAR_ALTZONE
|
#if HAVE_VAR_ALTZONE
|
||||||
off = -(daylight ? timezone : altzone) / 60;
|
off = -(daylight ? timezone : altzone) / 60;
|
||||||
#else
|
#else
|
||||||
off = -timezone / 60;
|
off = -timezone / 60;
|
||||||
#endif
|
#endif
|
||||||
|
#else /* !HAVE_TIMEZONE */
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
|
gettimeofday(&tv, &zone);
|
||||||
|
off = -zone.tz_minuteswest;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* !HAVE_TIMEZONE */
|
||||||
#endif /* !HAVE_TM_ZONE */
|
#endif /* !HAVE_TM_ZONE */
|
||||||
#endif /* !HAVE_TM_NAME */
|
#endif /* !HAVE_TM_NAME */
|
||||||
if (off < 0) {
|
if (off < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user