public static Time operator +(Time t1, Time t2) { Time t3 = new Time(t1.Hour, t1.Minute, t1.Second); t3.Add(t2); return t3; }
/// <summary> /// Calculate time difference between two second values. /// </summary> /// <param name="seconds1"></param> /// <param name="seconds2"></param> /// <returns></returns> public static Time TimeDiff(int seconds1, int seconds2) { try { Time t1 = new Time(seconds1); Time t2 = new Time(seconds2); return TimeDiff(t1, t2); } catch { return new Time(0, 0, 0); } }
/// <summary> /// Calculate time difference between two string values. /// </summary> /// <param name="time1"></param> /// <param name="time2"></param> /// <returns></returns> public static Time TimeDiff(string time1, string time2) { try { Time t1 = new Time(time1); Time t2 = new Time(time2); return TimeDiff(t1, t2); } catch { return new Time(0, 0, 0); } }
/// <summary> /// Calculate time difference between two time objects. /// </summary> /// <param name="time1"></param> /// <param name="time2"></param> /// <returns></returns> public static Time TimeDiff(Time time1, Time time2) { try { int _secs1 = time1.ToSeconds(); int _secs2 = time2.ToSeconds(); int _secs = _secs1 - _secs2; return GetTimeFromSeconds(_secs); } catch { return new Time(0, 0, 0); } }
/// <summary> /// Add new time object and addition (+) it to previus time object. /// </summary> /// <param name="time"></param> /// <returns></returns> public Time Add(Time time) { this.Hour += time.Hour; this.Minute += time.Minute; this.Second += time.Second; return new Time(GetStringTime(this.ToSeconds())); }
public void SetPosition() { float ff = this.DataRect.X + this.DataRect.Width; Time tt = new Time(Convert.ToInt32(ff)); }