Aura.Mabi.ErinnTime.GetNextTime C# (CSharp) Method

GetNextTime() public static method

Returns an instance of ErinnTime that's set to the next time the given hour and minute is.
public static GetNextTime ( System.DateTime now, int hour, int minute ) : ErinnTime
now System.DateTime
hour int
minute int
return ErinnTime
		public static ErinnTime GetNextTime(DateTime now, int hour, int minute)
		{
			if (hour < 0 || hour > 23)
				throw new ArgumentException("Invalid hour.");
			if (minute < 0 || minute > 59)
				throw new ArgumentException("Invalid minute.");

			var nowErinn = new ErinnTime(now);

			var hours = hour - nowErinn.Hour;
			var minutes = minute - nowErinn.Minute;

			if (hours <= 0)
			{
				hours += 24;
			}

			if (minutes < 0)
			{
				minutes = 60 + minutes;
				hours -= 1;
			}

			var thenDateTime = now.AddTicks(hours * TicksPerHour).AddTicks(minutes * TicksPerMinute);

			return new ErinnTime(thenDateTime);
		}
	}

Same methods

ErinnTime::GetNextTime ( int hour, int minute ) : ErinnTime