public int CompareTo(object obj) { var target = obj as ASSEventTime; if (target == null) { target = new ASSEventTime(obj.ToString()); } return((int)(this.TotalMilliseconds() - target.TotalMilliseconds())); }
public static ASSEventTime operator -(ASSEventTime aet, double num) { var ms = Convert.ToInt32(Math.Floor(num * 1000)); var target = new ASSEventTime(aet.ToString()); target.Millisecond = aet.Millisecond - ms; if (target.Millisecond < 0) { target.Millisecond += 1000; target.Second -= 1; } if (target.Second < 0) { target.Second += 60; target.Minute -= 1; } if (target.Minute < 0) { target.Minute += 60; target.Hour -= 1; } return(target); }
public static ASSEventTime operator +(ASSEventTime aet, double num) { var target = new ASSEventTime(aet.ToString()); var ms = Convert.ToInt32(Math.Floor(num * 1000)); target.Millisecond = target.Millisecond + ms; if (target.Millisecond > 1000) { target.Second += target.Millisecond / 1000; target.Millisecond = target.Millisecond % 1000; } if (target.Second > 60) { target.Minute += target.Second / 60; target.Second = target.Second % 60; } if (target.Minute > 60) { target.Hour += target.Minute / 60; target.Minute = target.Minute % 60; } return(target); }