ruby-changes:3714
From: ko1@a...
Date: Thu, 24 Jan 2008 15:11:05 +0900 (JST)
Subject: [ruby-changes:3714] akr - Ruby:r15203 (trunk): * time.c (make_time_t): revert round trip test.
akr 2008-01-24 15:10:49 +0900 (Thu, 24 Jan 2008) New Revision: 15203 Modified files: trunk/ChangeLog trunk/time.c Log: * time.c (make_time_t): revert round trip test. [ruby-dev:33058] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/time.c?r1=15203&r2=15202&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15203&r2=15202&diff_format=u Index: time.c =================================================================== --- time.c (revision 15202) +++ time.c (revision 15203) @@ -825,37 +825,40 @@ 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 Index: ChangeLog =================================================================== --- ChangeLog (revision 15202) +++ ChangeLog (revision 15203) @@ -1,3 +1,7 @@ +Thu Jan 24 15:09:40 2008 Tanaka Akira <akr@f...> + + * time.c (make_time_t): revert round trip test. [ruby-dev:33058] + Thu Jan 24 11:14:56 2008 Tanaka Akira <akr@f...> * string.c (rb_enc_cr_str_buf_cat): ASCII incompatible encoding is -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/