/// <summary> /// Return the number of seconds that corresponds to the given TimeIntervalRate, /// e.g. for EveryMinute return 60. /// </summary> public static int SecondsForInterval(TimeIntervalRate eEveryNMinutes) { int iSeconds = 60; switch (eEveryNMinutes) { case TimeIntervalRate.EveryMinute: iSeconds = 60; break; case TimeIntervalRate.Every5Minutes: iSeconds = 300; break; case TimeIntervalRate.Every10Minutes: iSeconds = 600; break; case TimeIntervalRate.Every15Minutes: iSeconds = 15 * 60; break; case TimeIntervalRate.Every30Minutes: iSeconds = 30 * 60; break; case TimeIntervalRate.Hourly: iSeconds = 60 * 60; break; } return(iSeconds); }
/// <summary> /// Given a TimeIntervalRate, return the number of seconds until the next actual occurance /// of that boundary. Ie, if the rate is hourly, and it's presently 3:59pm, return 60. /// </summary> /// <param name="eEveryNMinutes">an enum that expresses a rate</param> /// <returns>The number of seconds before the next interval boundary</returns> public static int SecondsToIntervalBoundary(TimeIntervalRate eEveryNMinutes) { int iEveryNMinutes = 60; switch (eEveryNMinutes) { case TimeIntervalRate.EveryMinute: iEveryNMinutes = 1; break; case TimeIntervalRate.Every5Minutes: iEveryNMinutes = 5; break; case TimeIntervalRate.Every10Minutes: iEveryNMinutes = 10; break; case TimeIntervalRate.Every15Minutes: iEveryNMinutes = 15; break; case TimeIntervalRate.Every30Minutes: iEveryNMinutes = 30; break; case TimeIntervalRate.Hourly: iEveryNMinutes = 60; break; } return(SecondsToIntervalBoundary(iEveryNMinutes)); }
/// <summary> /// Given a TimeIntervalRate, return the number of seconds until the next actual occurance /// of that boundary. Ie, if the rate is hourly, and it's presently 3:59pm, return 60. /// </summary> /// <param name="eEveryNMinutes">an enum that expresses a rate</param> /// <returns>The number of seconds before the next interval boundary</returns> public static int SecondsToIntervalBoundary(TimeIntervalRate eEveryNMinutes) { int iEveryNMinutes = 60; switch (eEveryNMinutes) { case TimeIntervalRate.EveryMinute: iEveryNMinutes = 1; break; case TimeIntervalRate.Every5Minutes: iEveryNMinutes = 5; break; case TimeIntervalRate.Every10Minutes: iEveryNMinutes = 10; break; case TimeIntervalRate.Every15Minutes: iEveryNMinutes = 15; break; case TimeIntervalRate.Every30Minutes: iEveryNMinutes = 30; break; case TimeIntervalRate.Hourly: iEveryNMinutes = 60; break; } return SecondsToIntervalBoundary(iEveryNMinutes); }
/// <summary> /// Return the number of seconds that corresponds to the given TimeIntervalRate, /// e.g. for EveryMinute return 60. /// </summary> public static int SecondsForInterval(TimeIntervalRate eEveryNMinutes) { int iSeconds = 60; switch (eEveryNMinutes) { case TimeIntervalRate.EveryMinute: iSeconds = 60; break; case TimeIntervalRate.Every5Minutes: iSeconds = 300; break; case TimeIntervalRate.Every10Minutes: iSeconds = 600; break; case TimeIntervalRate.Every15Minutes: iSeconds = 15 * 60; break; case TimeIntervalRate.Every30Minutes: iSeconds = 30 * 60; break; case TimeIntervalRate.Hourly: iSeconds = 60 * 60; break; } return iSeconds; }