summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-19 15:45:46 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-19 15:45:46 +0000
commit7e35911e105409fabe48dc2a6214479b6a6ffa24 (patch)
tree5b28440687c1701389b14598454e99aee9a925ba /time.c
parente08bc0a22ae6c2d2ac0664d82675ca81a30df607 (diff)
* ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
before detach pid. [ruby-talk:71519] * eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677], [ruby-dev:20202] * eval.c (BEGIN_CALLARGS): restore outer block by using ruby_block->outer. * eval.c (block_pass): do not alter block->prev, but block->outer. * array.c (get_inspect_tbl): warning on wrong condition. * eval.c (localjump_xvalue): renamed exitstatus to exit_value since it's not exit "status" after all. * eval.c (localjump_error): add reason to LocalJumpError. * compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value is nil. now take new 2 arguments. * time.c (time_cmp): 2003-05-16 fix was incomplete. (ruby-bugs-ja:PR#458) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/time.c b/time.c
index cb5d508..7348906 100644
--- a/time.c
+++ b/time.c
@@ -704,31 +704,15 @@ time_cmp(time1, time2)
long i;
GetTimeval(time1, tobj1);
- switch (TYPE(time2)) {
- case T_FIXNUM:
- i = FIX2LONG(time2);
- if (tobj1->tv.tv_sec == i) {
- if (tobj1->tv.tv_usec == 0)
- return INT2FIX(0);
- if (tobj1->tv.tv_usec > 0)
- return INT2FIX(1);
+ if (TYPE(time2) == T_DATA && RDATA(time2)->dfree == time_free) {
+ GetTimeval(time2, tobj2);
+ if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
+ if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return INT2FIX(0);
+ if (tobj1->tv.tv_usec > tobj2->tv.tv_usec) return INT2FIX(1);
return INT2FIX(-1);
}
- if (tobj1->tv.tv_sec > i) return INT2FIX(1);
+ if (tobj1->tv.tv_sec > tobj2->tv.tv_sec) return INT2FIX(1);
return INT2FIX(-1);
-
- case T_DATA:
- if (RDATA(time2)->dfree == time_free) {
- GetTimeval(time2, tobj2);
- if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
- if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return INT2FIX(0);
- if (tobj1->tv.tv_usec > tobj2->tv.tv_usec) return INT2FIX(1);
- return INT2FIX(-1);
- }
- if (tobj1->tv.tv_sec > tobj2->tv.tv_sec) return INT2FIX(1);
- return INT2FIX(-1);
- }
- break;
}
return Qnil;