summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-05 07:45:32 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-05 07:45:32 +0000
commit849bc0234abaa8458f132981404e198666c5610b (patch)
tree087d802ac34ba666eb197b3023171b77d9f0829c /time.c
parent1b33576053bc1f0a01deee86f9a5821cb96c65c0 (diff)
* eval.c (top_include): include in the wrapped load is done for
the wrapper, not for a singleton class for wrapped main. [ruby-dev:23305] * bignum.c (rb_big_eq): use temporary double variable to save the result (internal float register may be bigger than 64 bits, for example, 80 bits on x86). [ruby-dev:23311] * eval.c (block_pass): should generate unique identifier of the pushing block. [ruby-talk:96363] * ext/socket/socket.c (make_hostent): fix memory leak, based on the patch from HORIKAWA Hisashi <vzw00011@nifty.ne.jp>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/time.c b/time.c
index 2dec206..b6b16a1 100644
--- a/time.c
+++ b/time.c
@@ -110,10 +110,10 @@ time_init(time)
#define NMOD(x,y) ((y)-(-((x)+1)%(y))-1)
void
-time_overflow_p(sec, usec)
- time_t sec, usec;
+time_overflow_p(secp, usecp)
+ time_t *secp, *usecp;
{
- time_t tmp;
+ time_t tmp, sec = *secp, usec = *usecp;
if (usec >= 1000000) { /* usec positive overflow */
tmp = sec + usec / 1000000;
@@ -135,6 +135,8 @@ time_overflow_p(sec, usec)
if (sec < 0 || (sec == 0 && usec < 0))
rb_raise(rb_eArgError, "time must be positive");
#endif
+ *secp = sec;
+ *usecp = usec;
}
static VALUE
@@ -146,7 +148,7 @@ time_new_internal(klass, sec, usec)
struct time_object *tobj;
GetTimeval(time, tobj);
- time_overflow_p(sec, usec);
+ time_overflow_p(&sec, &usec);
tobj->tv.tv_sec = sec;
tobj->tv.tv_usec = usec;
@@ -1895,7 +1897,7 @@ time_mdump(time)
tm = gmtime(&t);
if ((tm->tm_year & 0x1ffff) != tm->tm_year)
- rb_raise(rb_eArgError, "too big year to marshal");
+ rb_raise(rb_eArgError, "year too big to marshal");
p = 0x1 << 31 | /* 1 */
tm->tm_year << 14 | /* 17 */
@@ -1990,7 +1992,7 @@ time_mload(time, str)
sec = make_time_t(&tm, Qtrue);
usec = (time_t)(s & 0xfffff);
}
- time_overflow_p(sec, usec);
+ time_overflow_p(&sec, &usec);
GetTimeval(time, tobj);
tobj->tm_got = 0;