static internal object minus(RBasic r, params object[] args) { NetRuby rb = r.ruby; if (args[0] is RTime) { double d = ((RTime)args[0]).ToDouble(); return(new RFloat(rb, (((RTime)r).ToDouble() - d) / 10000000)); } long l = ((RTime)r).ToLong() - RInteger.ToLong(rb, args[0]); RTime result = new RTime(rb, l * 10000000 + RTimeClass.Epoch); return(result.CopyFormat((RTime)r)); }
static internal object plus(RBasic r, params object[] args) { NetRuby rb = r.ruby; if (args[0] is RTime) { throw new eTypeError("time + time?"); } long l = RInteger.ToLong(rb, args[0]); l += ((RTime)r).ToLong(); RTime result = new RTime(rb, l * 10000000 + RTimeClass.Epoch); return(result.CopyFormat((RTime)r)); }
static internal object minus(RBasic r, params object[] args) { NetRuby rb = r.ruby; if (args[0] is RTime) { double d = ((RTime)args[0]).ToDouble(); return new RFloat(rb, (((RTime)r).ToDouble() - d) / 10000000); } long l = ((RTime)r).ToLong() - RInteger.ToLong(rb, args[0]); RTime result = new RTime(rb, l * 10000000 + RTimeClass.Epoch); return result.CopyFormat((RTime)r); }
static internal object plus(RBasic r, params object[] args) { NetRuby rb = r.ruby; if (args[0] is RTime) { throw new eTypeError("time + time?"); } long l = RInteger.ToLong(rb, args[0]); l += ((RTime)r).ToLong(); RTime result = new RTime(rb, l * 10000000 + RTimeClass.Epoch); return result.CopyFormat((RTime)r); }