diff --git a/ChangeLog b/ChangeLog index 929853c225..4a03f31918 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Mar 28 10:12:28 2010 Tanaka Akira + + * time.c (rb_time_magnify): fix for LP64. + Sun Mar 28 09:28:33 2010 NARUSE, Yui * lib/scanf.rb: fix %[egEFG] isn't accept. diff --git a/time.c b/time.c index 1faa5c87b8..63780416dd 100644 --- a/time.c +++ b/time.c @@ -594,12 +594,22 @@ rb_time_magnify(VALUE v) #else long a, b, c; a = FIX2LONG(v); - if (a == 0) - return x; + if (a == 0) { +#if WIDEINT_IS_UINT64 + WIDEVAL_SET(ret, INT64toFIXWV(0)); +#else + WIDEVAL_SET(ret, INT2FIX(0)); +#endif + return ret; + } b = TIME_SCALE; c = a * b; if (c / a == b) { +#if WIDEINT_IS_UINT64 WIDEVAL_SET(ret, INT64toFIXWV(c)); +#else + WIDEVAL_SET(ret, LONG2NUM(c)); +#endif return ret; } #endif