mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
18b17dcd19
commit
44320bc32c
2 changed files with 14 additions and 0 deletions
|
@ -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
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue