From 815bd0c66f7f64aa6edd6011b8e065cc9e1e641b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Sat, 7 Dec 2024 03:49:18 +0100 Subject: [PATCH] gtfs loader: make time monotonic increasing --- src/loader/gtfs/load_timetable.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/loader/gtfs/load_timetable.cc b/src/loader/gtfs/load_timetable.cc index 2bb0c81c..2aa622a2 100644 --- a/src/loader/gtfs/load_timetable.cc +++ b/src/loader/gtfs/load_timetable.cc @@ -137,6 +137,13 @@ void load_timetable(loader_config const& config, sort_by(t.seq_numbers_, t.stop_seq_, t.event_times_, t.stop_headsigns_, t.distance_traveled_); } + + auto pred = minutes_after_midnight_t{0U}; + for (auto& [arr, dep] : t.event_times_) { + arr = std::max(pred, arr); + dep = std::max(arr, dep); + pred = dep; + } } }