Beispiel #1
0
 public static RubyTime /*!*/ AddSeconds(RubyTime /*!*/ self, [DefaultProtocol] double seconds)
 {
     try {
         return(new RubyTime(RubyTime.AddSeconds(self.DateTime, seconds)));
     } catch (OverflowException) {
         throw RubyExceptions.CreateRangeError("time + {0:F6} out of Time range", seconds);
     }
 }
Beispiel #2
0
        public static RubyTime /*!*/ SubtractSeconds(RubyTime /*!*/ self, [DefaultProtocol] double seconds)
        {
            DateTime result;

            try {
                result = RubyTime.AddSeconds(self.DateTime, -seconds);
            } catch (OverflowException) {
                throw RubyExceptions.CreateRangeError("time - {0:F6} out of Time range", seconds);
            }
            return(new RubyTime(result));
        }
Beispiel #3
0
 public static RubyTime /*!*/ Create(RubyClass /*!*/ self, double seconds)
 {
     return(new RubyTime(RubyTime.ToLocalTime(RubyTime.AddSeconds(RubyTime.Epoch, seconds))));
 }