diff --git a/ChangeLog b/ChangeLog index dac2ec03a2..d061059cfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jan 24 15:09:40 2008 Tanaka Akira + + * time.c (make_time_t): revert round trip test. [ruby-dev:33058] + Thu Jan 24 11:14:56 2008 Tanaka Akira * string.c (rb_enc_cr_str_buf_cat): ASCII incompatible encoding is diff --git a/time.c b/time.c index 59d36088a3..2b00a538be 100644 --- a/time.c +++ b/time.c @@ -825,37 +825,40 @@ make_time_t(struct tm *tptr, int utc_p) buf = *tptr; if (utc_p) { #if defined(HAVE_TIMEGM) - t = timegm(&buf); - if (t == (time_t)-1) -#endif - t = search_time_t(&buf, utc_p); + if ((t = timegm(&buf)) != -1) + return t; +#ifdef NEGATIVE_TIME_T if ((tmp = gmtime(&t)) && tptr->tm_year == tmp->tm_year && tptr->tm_mon == tmp->tm_mon && tptr->tm_mday == tmp->tm_mday && tptr->tm_hour == tmp->tm_hour && tptr->tm_min == tmp->tm_min && - tptr->tm_sec == tmp->tm_sec) { + tptr->tm_sec == tmp->tm_sec + ) return t; - } +#endif +#endif + return search_time_t(&buf, utc_p); } else { #if defined(HAVE_MKTIME) - t = mktime(&buf); - if (t == (time_t)-1) -#endif - t = search_time_t(&buf, utc_p); + if ((t = mktime(&buf)) != -1) + return t; +#ifdef NEGATIVE_TIME_T if ((tmp = localtime(&t)) && tptr->tm_year == tmp->tm_year && tptr->tm_mon == tmp->tm_mon && tptr->tm_mday == tmp->tm_mday && tptr->tm_hour == tmp->tm_hour && tptr->tm_min == tmp->tm_min && - tptr->tm_sec == tmp->tm_sec) { + tptr->tm_sec == tmp->tm_sec + ) return t; - } +#endif +#endif + return search_time_t(&buf, utc_p); } - rb_raise(rb_eArgError, "couldn't generate a time"); } static VALUE