Created
September 19, 2009 02:33
-
-
Save jasondew/189385 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static VALUE | |
time_cmp(time1, time2) | |
VALUE time1, time2; | |
{ | |
struct time_object *tobj1, *tobj2; | |
GetTimeval(time1, tobj1); | |
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 > tobj2->tv.tv_sec) return INT2FIX(1); | |
return INT2FIX(-1); | |
} | |
return Qnil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment