-(p1)
public
Difference—Returns a new time that
represents the difference between two times, or subtracts the given number
of seconds in numeric from time.
t = Time.now
t2 = t + 2592000
t2 - t
t2 - 2592000
Show source
static VALUE
time_minus(VALUE time1, VALUE time2)
{
struct time_object *tobj;
GetTimeval(time1, tobj);
if (IsTimeval(time2)) {
struct time_object *tobj2;
GetTimeval(time2, tobj2);
return rb_Float(rb_time_unmagnify_to_float(wsub(tobj->timew, tobj2->timew)));
}
return time_add(tobj, time2, -1);
}