mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (make_time_t): revert round trip test. [ruby-dev:33058]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
968e404220
commit
4eca4cadff
2 changed files with 20 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Jan 24 15:09:40 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* time.c (make_time_t): revert round trip test. [ruby-dev:33058]
|
||||
|
||||
Thu Jan 24 11:14:56 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* string.c (rb_enc_cr_str_buf_cat): ASCII incompatible encoding is
|
||||
|
|
29
time.c
29
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
|
||||
|
|
Loading…
Reference in a new issue