Commit 41baf125 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

Time#- should return time if operand is a number

parent a7707bae
...@@ -363,8 +363,11 @@ mrb_time_minus(mrb_state *mrb, mrb_value self) ...@@ -363,8 +363,11 @@ mrb_time_minus(mrb_state *mrb, mrb_value self)
return mrb_float_value(f); return mrb_float_value(f);
} }
else { else {
mrb_get_args(mrb, "f", &f); mrb_float f, f2;
return mrb_time_make(mrb, mrb_obj_class(mrb, self), f, tm->timezone); mrb_get_args(mrb, "f", &f2);
f = ((mrb_float)tm->sec + (mrb_float)tm->usec/1.0e6);
return mrb_time_make(mrb, mrb_obj_class(mrb, self), f-f2, tm->timezone);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment