/// <summary> /// Normalizes this instance. /// </summary> /// <remarks></remarks> public void Normalize() { int millisecs = this.Millis; if (millisecs % 1000 == 0) { unit = TimeUnits.SECONDS; timeout = millisecs / 1000; if (timeout % 60 == 0) { unit = TimeUnits.MINUTES; timeout /= 60; if (timeout % 60 == 0) { unit = TimeUnits.HOURS; timeout /= 60; } } } }
public Timeout(int period, TimeUnits unit) { this.timeout = period; if (unit != null) this.unit = unit; }