mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (time_timeval): rounds subsecond toward zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
703bff0b24
commit
4e94c36f3d
3 changed files with 14 additions and 15 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Jul 13 01:18:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* time.c (time_timeval): rounds subsecond toward zero.
|
||||
|
||||
Fri Jul 3 06:19:58 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/complex.rb (Numeric#arg): should return NaN for NaN.
|
||||
|
|
19
time.c
19
time.c
|
@ -192,22 +192,17 @@ time_timeval(time, interval)
|
|||
double f, d;
|
||||
|
||||
d = modf(RFLOAT(time)->value, &f);
|
||||
if (d < 0) {
|
||||
d += 1;
|
||||
f -= 1;
|
||||
}
|
||||
if (d >= 0) {
|
||||
t.tv_usec = (int)(d*1e6+0.5);
|
||||
}
|
||||
else if ((t.tv_usec = (int)(-d*1e6+0.5)) > 0) {
|
||||
t.tv_usec = 1000000 - t.tv_usec;
|
||||
f -= 1;
|
||||
}
|
||||
t.tv_sec = (time_t)f;
|
||||
if (f != t.tv_sec) {
|
||||
rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT(time)->value);
|
||||
}
|
||||
t.tv_usec = (int)(d*1e6+0.5);
|
||||
if (t.tv_usec >= 1000000) {
|
||||
t.tv_usec -= 1000000;
|
||||
if (++t.tv_sec <= 0) {
|
||||
--t.tv_sec;
|
||||
t.tv_usec = 999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.8.8"
|
||||
#define RUBY_RELEASE_DATE "2009-07-03"
|
||||
#define RUBY_RELEASE_DATE "2009-07-13"
|
||||
#define RUBY_VERSION_CODE 188
|
||||
#define RUBY_RELEASE_CODE 20090703
|
||||
#define RUBY_RELEASE_CODE 20090713
|
||||
#define RUBY_PATCHLEVEL -1
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 8
|
||||
#define RUBY_RELEASE_YEAR 2009
|
||||
#define RUBY_RELEASE_MONTH 7
|
||||
#define RUBY_RELEASE_DAY 3
|
||||
#define RUBY_RELEASE_DAY 13
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue