Permalink
Browse files

merge revision(s) 23259,24059:

	* time.c (time_timeval): check out-of-range.  [ruby-core:23282]
	  [Bug #1396]
	* time.c (time_timeval): rounds subsecond toward zero.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@24060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 19ad003 commit 64625c4b097e495aecf5c90220e8febd8b8ea395 @shyouhei shyouhei committed Jul 12, 2009
Showing with 20 additions and 9 deletions.
  1. +9 −0 ChangeLog
  2. +7 −5 time.c
  3. +4 −4 version.h
View
9 ChangeLog
@@ -1,3 +1,12 @@
+Mon Jul 13 01:36:54 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (time_timeval): rounds subsecond toward zero.
+
+Mon Jul 13 01:36:54 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (time_timeval): check out-of-range. [ruby-core:23282]
+ [Bug #1396]
+
Thu Jul 9 17:58:03 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (proc_invoke): shares dmethod scope local variables.
View
12 time.c
@@ -192,15 +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 = (time_t)(d*1e6+0.5);
}
break;
View
8 version.h
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2009-07-09"
+#define RUBY_RELEASE_DATE "2009-07-13"
#define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20090709
-#define RUBY_PATCHLEVEL 181
+#define RUBY_RELEASE_CODE 20090713
+#define RUBY_PATCHLEVEL 182
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 9
+#define RUBY_RELEASE_DAY 13
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];

0 comments on commit 64625c4

Please sign in to comment.