Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions SRT/srt.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ def _search_train(
# Note: updated api returns subarray of all trains,
# therefore, to retrieve all trains, retry unless there are no more trains
while trains:
# Break if the last train's departure time is over the time_limit
if time_limit and trains[-1].dep_time > time_limit:
break

last_dep_time = datetime.strptime(trains[-1].dep_time, "%H%M%S")
next_dep_time = last_dep_time + timedelta(seconds=1)
data["dptTm"] = next_dep_time.strftime("%H%M%S")
Expand Down