* time.c (find_time_t): use mktime for the first guess.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-08-30 14:44:54 +00:00
Родитель 18b17dcd19
Коммит 44320bc32c
2 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Sun Aug 30 23:44:09 2009 Tanaka Akira <akr@fsij.org>
* time.c (find_time_t): use mktime for the first guess.
Sun Aug 30 16:38:56 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (rb_enc_symname2_p): not depend on nul terminator.

10
time.c
Просмотреть файл

@ -1962,6 +1962,16 @@ find_time_t(struct tm *tptr, int utc_p, time_t *tp)
find_dst = 0 < tptr->tm_isdst;
#if defined(HAVE_MKTIME)
tm0 = *tptr;
if (!utc_p && (guess = mktime(&tm0)) != -1) {
tm = GUESS(&guess);
if (tm && tmcmp(tptr, tm) == 0) {
goto found;
}
}
#endif
tm0 = *tptr;
if (tm0.tm_mon < 0) {
tm0.tm_mon = 0;