summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-30 14:44:54 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-30 14:44:54 +0000
commit44320bc32c34ed0b330c647258f623af6d1dd17a (patch)
tree4e205c67413f5fee8a72d85faee6ed1a2aa1c7c6 /time.c
parent18b17dcd19ddde322b96002cac583e664696ae3a (diff)
* 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
Diffstat (limited to 'time.c')
-rw-r--r--time.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/time.c b/time.c
index 8a680c9f15..edff7ee7a3 100644
--- a/time.c
+++ b/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;