diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-22 16:58:16 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-22 16:58:16 +0000 |
commit | 428269821916bf8ed7c058340640edd8105cf599 (patch) | |
tree | d7a9178234642f4fb987b386b2e291d627692cb3 | |
parent | 0a45dee5a529461b0e6eb69f14ef4e32eb2ccc9b (diff) |
* time.c (time_timeval): wrong cast to time_t.
* time.c (time_plus): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | time.c | 10 |
2 files changed, 11 insertions, 5 deletions
@@ -1,3 +1,9 @@ +Sat Dec 22 22:52:14 2001 Yukihiro Matsumoto <[email protected]> + + * time.c (time_timeval): wrong cast to time_t. + + * time.c (time_plus): ditto. + Fri Dec 21 20:33:34 2001 K.Kosako <[email protected]> * parse.y (str_extend): make up "#$;" handling. @@ -140,7 +140,7 @@ time_timeval(time, interval) if (f != t.tv_sec) { rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT(time)->value); } - t.tv_usec = (time_t)d*1e6; + t.tv_usec = (time_t)(d*1e6); } break; @@ -953,7 +953,7 @@ time_plus(time1, time2) v = NUM2DBL(time2); d = modf(v, &f); sec = (time_t)f; - if (f != (double)sec || d >= 1.0 || d <= -1.0) { + if (f != (double)sec) { rb_raise(rb_eRangeError, "time + %f out of Time range", v); } #ifndef NEGATIVE_TIME_T @@ -961,7 +961,7 @@ time_plus(time1, time2) rb_raise(rb_eArgError, "time must be positive"); } #endif - usec = tobj->tv.tv_usec + (time_t)d*1e6; + usec = tobj->tv.tv_usec + (time_t)(d*1e6); sec = tobj->tv.tv_sec + (time_t)f; #ifdef NEGATIVE_TIME_T @@ -1000,7 +1000,7 @@ time_minus(time1, time2) v = NUM2DBL(time2); d = modf(v, &f); sec = (time_t)f; - if (f != (double)sec || d >= 1.0 || d <= -1.0) { + if (f != (double)sec) { rb_raise(rb_eRangeError, "time - %f out of Time range", v); } #ifndef NEGATIVE_TIME_T @@ -1401,7 +1401,7 @@ time_load(klass, str) tm.tm_isdst = 0; sec = make_time_t(&tm, Qtrue); - usec = (time_t) s & 0xfffff; + usec = (time_t)(s & 0xfffff); return time_new_internal(klass, sec, usec); } |