summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-22 16:58:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-22 16:58:16 +0000
commit428269821916bf8ed7c058340640edd8105cf599 (patch)
treed7a9178234642f4fb987b386b2e291d627692cb3 /time.c
parent0a45dee5a529461b0e6eb69f14ef4e32eb2ccc9b (diff)
* time.c (time_timeval): wrong cast to time_t.
* time.c (time_plus): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/time.c b/time.c
index 9323dca..c4c3da9 100644
--- a/time.c
+++ b/time.c
@@ -140,7 +140,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);
}
break;
@@ -953,7 +953,7 @@ time_plus(time1, time2)
v = NUM2DBL(time2);
d = modf(v, &f);
sec = (time_t)f;
- if (f != (double)sec || d >= 1.0 || d <= -1.0) {
+ if (f != (double)sec) {
rb_raise(rb_eRangeError, "time + %f out of Time range", v);
}
#ifndef NEGATIVE_TIME_T
@@ -961,7 +961,7 @@ time_plus(time1, time2)
rb_raise(rb_eArgError, "time must be positive");
}
#endif
- usec = tobj->tv.tv_usec + (time_t)d*1e6;
+ usec = tobj->tv.tv_usec + (time_t)(d*1e6);
sec = tobj->tv.tv_sec + (time_t)f;
#ifdef NEGATIVE_TIME_T
@@ -1000,7 +1000,7 @@ time_minus(time1, time2)
v = NUM2DBL(time2);
d = modf(v, &f);
sec = (time_t)f;
- if (f != (double)sec || d >= 1.0 || d <= -1.0) {
+ if (f != (double)sec) {
rb_raise(rb_eRangeError, "time - %f out of Time range", v);
}
#ifndef NEGATIVE_TIME_T
@@ -1401,7 +1401,7 @@ time_load(klass, str)
tm.tm_isdst = 0;
sec = make_time_t(&tm, Qtrue);
- usec = (time_t) s & 0xfffff;
+ usec = (time_t)(s & 0xfffff);
return time_new_internal(klass, sec, usec);
}