mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 18:13:58 +02:00
* time.c: new method gmtoff',
gmt_offset' and `utc_offset'.
(time_utc_offset): new function. (Init_Time): bind above methods to `time_utc_offset'. * time.c: 64bit time_t support. (time_s_at): use NUM2LONG instead of NUM2INT for tv_sec. (time_arg): initialize tm_isdst correctly. use long to initialize tm_year. (search_time_t): renamed from `make_time_t'. (make_time_t): call `timegm' and `mktime' instead of `search_time_t' if availabe. (time_to_i): use LONG2NUM instead of INT2NUM. (time_localtime): check localtime failure. (time_gmtime): check gmtime failure. (time_year): use LONG2NUM instead of INT2FIX. (time_to_a): use long for tm_year. (time_dump): check tm_year which is not representable with 17bit. (time_load): initialize tm_isdst. * configure.in: check existence of `mktime' and `timegm'. check existence of tm_gmtoff field of struct tm. fix negative time_t for 64bit time_t. * missing/strftime.c: fix overflow by tm_year + 1900. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39c0252e04
commit
b48e38c526
4 changed files with 180 additions and 27 deletions
13
configure.in
13
configure.in
|
@ -300,8 +300,17 @@ AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall chroot\
|
|||
setitimer setruid seteuid setreuid setresuid setproctitle\
|
||||
setrgid setegid setregid setresgid pause lchown lchmod\
|
||||
getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
|
||||
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod)
|
||||
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod\
|
||||
mktime timegm)
|
||||
AC_STRUCT_TIMEZONE
|
||||
AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
|
||||
[AC_TRY_COMPILE([#include <time.h>],
|
||||
[struct tm t; t.tm_gmtoff = 3600;],
|
||||
[rb_cv_member_struct_tm_tm_gmtoff=yes],
|
||||
[rb_cv_member_struct_tm_tm_gmtoff=no])])
|
||||
if test "$rb_cv_member_struct_tm_tm_gmtoff" = yes; then
|
||||
AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF)
|
||||
fi
|
||||
AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
|
||||
[AC_TRY_LINK([#include <time.h>
|
||||
int i;],
|
||||
|
@ -337,7 +346,7 @@ main()
|
|||
struct tm *tm;
|
||||
|
||||
check(gmtime(&t), 69, 12, 31, 23, 59);
|
||||
t = -0x80000000;
|
||||
t = ~(time_t)0 << 31;
|
||||
check(gmtime(&t), 1, 12, 13, 20, 52);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue