summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-16 12:55:59 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-16 12:55:59 (GMT)
commit9446db408ce9fec8116aa767ce159513558a3638 (patch)
tree087fa0d8b919977bc3b65d033e9c88c4e941c756 /time.c
parentbb1e08e770e6d3c6528e9d5041b52016b94bebd2 (diff)
Refine error message for time interval
* time.c (time_timespec): Time interval value can be zero, not only positive. [ruby-dev:50709] [Bug #15420] From: shuujii (Shuji KOBAYASHI) <shuujii@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/time.c b/time.c
index 8d272d9..e70899a 100644
--- a/time.c
+++ b/time.c
@@ -2524,12 +2524,12 @@ time_timespec(VALUE num, int interval)
if (FIXNUM_P(num)) {
t.tv_sec = NUM2TIMET(num);
if (interval && t.tv_sec < 0)
- rb_raise(rb_eArgError, "%s must be positive", tstr);
+ rb_raise(rb_eArgError, "%s must not be negative", tstr);
t.tv_nsec = 0;
}
else if (RB_FLOAT_TYPE_P(num)) {
if (interval && RFLOAT_VALUE(num) < 0.0)
- rb_raise(rb_eArgError, "%s must be positive", tstr);
+ rb_raise(rb_eArgError, "%s must not be negative", tstr);
else {
double f, d;
@@ -2554,7 +2554,7 @@ time_timespec(VALUE num, int interval)
else if (RB_TYPE_P(num, T_BIGNUM)) {
t.tv_sec = NUM2TIMET(num);
if (interval && t.tv_sec < 0)
- rb_raise(rb_eArgError, "%s must be positive", tstr);
+ rb_raise(rb_eArgError, "%s must not be negative", tstr);
t.tv_nsec = 0;
}
else {
@@ -2565,7 +2565,7 @@ time_timespec(VALUE num, int interval)
f = rb_ary_entry(ary, 1);
t.tv_sec = NUM2TIMET(i);
if (interval && t.tv_sec < 0)
- rb_raise(rb_eArgError, "%s must be positive", tstr);
+ rb_raise(rb_eArgError, "%s must not be negative", tstr);
f = rb_funcall(f, '*', 1, INT2FIX(1000000000));
t.tv_nsec = NUM2LONG(f);
}