1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* time.c (time_timeval): should round for usec floating

number.  [ruby-core:07896]

* time.c (time_add): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-05-18 08:54:01 +00:00
parent 5c8d6f1bc3
commit 3326cc9e05
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,10 @@
Thu May 18 17:51:32 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_timeval): should round for usec floating
number. [ruby-core:07896]
* time.c (time_add): ditto.
Thu May 18 17:11:45 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi.rb (CGI::out): support utf-8. a patch from Fujioka

4
time.c
View file

@ -194,7 +194,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+0.5);
}
break;
@ -1287,7 +1287,7 @@ time_add(tobj, offset, sign)
if (f != (double)sec_off)
rb_raise(rb_eRangeError, "time %s %f out of Time range",
sign < 0 ? "-" : "+", v);
usec_off = (time_t)(d*1e6);
usec_off = (time_t)(d*1e6+0.5);
if (sign < 0) {
sec = tobj->tv.tv_sec - sec_off;