rust-transit / gtfs-structure

Read a GTFS file
MIT License
61 stars 32 forks source link

allow for train voyages longer than 4.1 days #149

Closed kylerchin closed 11 months ago

kylerchin commented 11 months ago

I recently encountered this error in my ingestion feed:

f-u4-ruter~flybussen~stfoldkollektivtrafikk~hedmarktrafikk~oppla is not a valid gtfs feed
CSVError { file_name: "stop_times.txt", source: Error(Deserialize { pos: Some(Position { byte: 99651536, line: 1007487, record: 1007487 }), err: DeserializeError { field: None, kind: Message("'100:35:00' is not a valid time; HH:MM:SS format is expected.") } }), line_in_error: Some(LineError { headers: ["trip_id", "stop_id", "arrival_time", "departure_time", "stop_sequence", "stop_headsign", "pickup_type", "drop_off_type", "shape_dist_traveled"], values: ["HAV:ServiceJourney:2023-09-03", "NSR:Quay:99528", "100:35:00", "100:50:00", "21", "", "", "", ""] }) }

It appears this train in Norway takes more than 4 days to complete it's voyage and is legitimate. I've rewritten the rest of the time parser to still conform to HH:MM:SS.

Tristramg commented 11 months ago

Thank you for remaining us that handling correctly time is tricky ;) I agree with antoine’s comments Would you also mind squashing the commits into a single one?

kylerchin commented 11 months ago

Done! Ready to be merged :)

kylerchin commented 11 months ago

@lolpro11 it's now the u32 limit of hours, or 489968 average Gregorian years. Just in case you need to put the 2016 movie 'Passengers' into GTFS or something. 🤣