summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-30 18:49:04 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-30 18:49:04 +0000
commit72be91b5c0fab9e2c65adf957bafa8cb7a1783b9 (patch)
tree8737b16efc73b2679e4a0bd613d28d8cd1c93f0b /ext/date
parent8fca66d7ebb50f8b3d7af8a5550dbcaf12138a3a (diff)
reedited previous commit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_core.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 1771d12fc2..397ba7a5fc 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -2300,17 +2300,17 @@ offset_to_sec(VALUE vof, int *rof)
#ifdef CANONICALIZATION_FOR_MATHN
if (!k_rational_p(vs)) {
- vn = vs;
- vd = INT2FIX(1);
- }
- else {
- vn = RRATIONAL(vs)->num;
- vd = RRATIONAL(vs)->den;
+ if (!FIXNUM_P(vs))
+ return 0;
+ n = FIX2LONG(vs);
+ if (n < -DAY_IN_SECONDS || n > DAY_IN_SECONDS)
+ return 0;
+ *rof = (int)n;
+ return 1;
}
-#else
+#endif
vn = RRATIONAL(vs)->num;
vd = RRATIONAL(vs)->den;
-#endif
if (FIXNUM_P(vn) && FIXNUM_P(vd) && (FIX2LONG(vd) == 1))
n = FIX2LONG(vn);