public int TimeToNextDeparture(RouteStation station, DateTime currentDt, int FirstDeparture, int LastDeparture) { int currentTime = currentDt.Hour * 60 + currentDt.Minute; if (TimeHelpers.IsTimeWithinInterval(currentTime, FirstDeparture, LastDeparture)) { int difference = TimeHelpers.Difference(FirstDeparture, currentTime); int passedTrains = difference / Interval; if (difference % Interval != 0) { passedTrains++; } int timeOfNextDeparture = TimeHelpers.AddMinutes(FirstDeparture, passedTrains * Interval); return(TimeHelpers.Difference(currentTime, timeOfNextDeparture)); } else { return(TimeHelpers.Difference(currentTime, FirstDeparture)); } }
public int LastDepartureFromDest(RouteStation station) { return(TimeHelpers.AddMinutes(EndTime, station.TimeFromDest)); }
public int FirstDepartureFromOrigin(RouteStation station) { return(TimeHelpers.AddMinutes(StartTime, station.TimeFromOrigin)); }