A span is the part of a trip between two consecutive stops with times;
stops with blank times inside it are kept blank. Its speed is its length,
calculated by get_trip_length() along the trip's shape (or, with a
warning, as straight lines between stops if there are no shapes; the
stops table is required), divided by the time from the departure at its
first stop to the arrival at its second. Spans whose length is NA (e.g.
in trips not linked to a shape) or 0 (e.g. between stops at the same
place) are left unchanged.
Each span slower than min_speed has its duration lowered to its length
divided by min_speed, rounded down to the whole second (so a very
short span may end up with a duration of 0). All the later times of the
trip are shifted earlier by the accumulated saved time, so dwell times are
kept. Times after midnight written as early morning times (e.g.
"00:30:00" instead of "24:30:00") are first fixed with
fix_overnight_times() in every trip, so the returned GTFS has them fixed.
Spans whose arrival is still earlier than the previous departure (by 12
hours or less) are left unchanged, with a warning. An error is raised if a
shift would result in a time earlier than "00:00:00". Only stop_times
is modified; its existing _secs columns are updated to match.
With first_stop and last_stop, matched as in set_trip_speed(), only
the spans between them are raised: times before first_stop don't change,
and the times at and after last_stop are shifted. The given stops must
have a time, so that no span crosses them (if only last_stop is given,
the trip's first stop needs none). Trips that don't visit first_stop and
then last_stop, or have blank times there, are left unchanged, with a
warning if they were given in trip_id or route_id.
from and to are compared with the departure at the segment's first stop
(or its arrival, if the departure is blank) as written in stop_times
(template times, for trips listed in frequencies), so use times past
"24:00:00" for departures after midnight. Trips without a time there are
left unchanged.