aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--process.c24
-rw-r--r--test/ruby/test_process.rb4
3 files changed, 18 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d442b874dc..4388dd26a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Aug 22 22:01:04 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): Strip "s" from unit names.
+
Thu Aug 22 20:14:59 2013 Tanaka Akira <akr@fsij.org>
* process.c (unsigned_clock_t): Defined.
diff --git a/process.c b/process.c
index a48833f93a..8bf0313e75 100644
--- a/process.c
+++ b/process.c
@@ -6672,27 +6672,27 @@ make_clock_result(struct timespec *tsp, VALUE unit)
{
long factor;
- if (unit == ID2SYM(rb_intern("nanoseconds"))) {
+ if (unit == ID2SYM(rb_intern("nanosecond"))) {
factor = 1000000000;
goto return_integer;
}
- else if (unit == ID2SYM(rb_intern("microseconds"))) {
+ else if (unit == ID2SYM(rb_intern("microsecond"))) {
factor = 1000000;
goto return_integer;
}
- else if (unit == ID2SYM(rb_intern("milliseconds"))) {
+ else if (unit == ID2SYM(rb_intern("millisecond"))) {
factor = 1000;
goto return_integer;
}
- else if (unit == ID2SYM(rb_intern("float_microseconds"))) {
+ else if (unit == ID2SYM(rb_intern("float_microsecond"))) {
factor = 1000000;
goto return_float;
}
- else if (unit == ID2SYM(rb_intern("float_milliseconds"))) {
+ else if (unit == ID2SYM(rb_intern("float_millisecond"))) {
factor = 1000;
goto return_float;
}
- else if (NIL_P(unit) || unit == ID2SYM(rb_intern("float_seconds"))) {
+ else if (NIL_P(unit) || unit == ID2SYM(rb_intern("float_second"))) {
factor = 1;
goto return_float;
}
@@ -6792,12 +6792,12 @@ make_clock_result(struct timespec *tsp, VALUE unit)
*
* +unit+ specifies a type of the return value.
*
- * [:float_seconds] number of seconds as a float (default)
- * [:float_milliseconds] number of milliseconds as a float
- * [:float_microseconds] number of microseconds as a float
- * [:milliseconds] number of milliseconds as an integer
- * [:microseconds] number of microseconds as an integer
- * [:nanoseconds] number of nanoseconds as an integer
+ * [:float_second] number of seconds as a float (default)
+ * [:float_millisecond] number of milliseconds as a float
+ * [:float_microsecond] number of microseconds as a float
+ * [:millisecond] number of milliseconds as an integer
+ * [:microsecond] number of microseconds as an integer
+ * [:nanosecond] number of nanoseconds as an integer
*
* The underlying function, clock_gettime(), returns a number of nanoseconds.
* Float object (IEEE 754 double) is not enough to represent
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 2e7f3a45f3..7ea0f3bbde 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1661,9 +1661,9 @@ EOS
end if windows?
def test_clock_gettime
- t1 = Process.clock_gettime(Process::CLOCK_REALTIME, :nanoseconds)
+ t1 = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
t2 = Time.now; t2 = t2.tv_sec * 1000000000 + t2.tv_nsec
- t3 = Process.clock_gettime(Process::CLOCK_REALTIME, :nanoseconds)
+ t3 = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
assert_operator(t1, :<=, t2)
assert_operator(t2, :<=, t3)
assert_raise(Errno::EINVAL) { Process.clock_gettime(:foo) }