internal static void ThrowIfInvalid(timedelta delta, string funcname) { if (delta != null) { if (delta._microseconds != 0 || delta._seconds % 60 != 0) { throw PythonOps.ValueError("tzinfo.{0}() must return a whole number of minutes", funcname); } int minutes = (int)(delta.TimeSpanWithDaysAndSeconds.TotalSeconds / 60); if (Math.Abs(minutes) >= 1440) { throw PythonOps.ValueError("tzinfo.{0}() returned {1}; must be in -1439 .. 1439", funcname, minutes); } } }
// supported operations private static time Add(time date, timedelta delta) { return new time(date._timeSpan.Add(delta.TimeSpanWithDaysAndSeconds), delta._microseconds + date._lostMicroseconds, date._tz); }