1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* time.c (find_time_t): test the result of LOCALTIME.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-06-10 22:37:40 +00:00
parent cb962c5ae5
commit 22ce9f81c3
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Fri Jun 11 07:34:25 2010 Tanaka Akira <akr@fsij.org>
* time.c (find_time_t): test the result of LOCALTIME.
Fri Jun 11 00:42:45 2010 Tanaka Akira <akr@fsij.org>
* time.c (rb_localtime_r2): fix localtime overflow check.

4
time.c
View file

@ -2870,7 +2870,7 @@ find_time_t(struct tm *tptr, int utc_p, time_t *tp)
guess2 += 24 * 60 * 60;
if (guess != guess2) {
tm = LOCALTIME(&guess2, result);
if (tmcmp(tptr, tm) == 0) {
if (tm && tmcmp(tptr, tm) == 0) {
if (guess < guess2)
*tp = guess;
else
@ -2895,7 +2895,7 @@ find_time_t(struct tm *tptr, int utc_p, time_t *tp)
guess2 -= 24 * 60 * 60;
if (guess != guess2) {
tm = LOCALTIME(&guess2, result);
if (tmcmp(tptr, tm) == 0) {
if (tm && tmcmp(tptr, tm) == 0) {
if (guess < guess2)
*tp = guess2;
else