Negative Stop-Times / Trips Before Midnight

37 views
Skip to first unread message

Brian Ferris

unread,
Apr 16, 2013, 8:41:15 AM4/16/13
to gtfs-c...@googlegroups.com
tl;dr - New tool to help agencies with trips before midnight.  Also, how would you interpret "-3:25" in stop_times.txt?

I know there have been some recent discussions from agencies and GTFS producers asking to extend stop_times.txt to support arrival and departure times that start "before" midnight.  I'm still hesitant to add this to the official spec, as it's a pretty major change to existing semantics.

That said, I'm also sympathetic to agencies who internally model trips that start before midnight on a given service date.  For these agencies, support for "negative" stop-times might make it simpler for them to generate their GTFS.

To help these agencies out, I've added support to the OneBusAway GTFS Transformer tool for "shifting" negative stop_times.txt entries:


(Look for the "Shift Negative Stop Times" entry)

The tool will take a feed with negative stop_times.txt entries and automatically shift these trips to use normal times, adding and adjusting calendar.txt and calendar_dates.txt entries as needed to keep the same schedule.

Ok, so hopefully that tool will be useful for a few agencies, but when I was coding it up, I ran into the following question.  If I told you a bus arrives at "-3:25", what time did it actually arrive on the previous day?  My interpretation was that "-3:25" is equivalent to "21:25" (aka 9:25 pm) on the previous day.  That is to say, only the hour is the negative part, specifying the offset from midnight.  Minutes are still positive.  The alternative interpretation is that minutes are also negative, such that "-3:25" is equivalent to "20:35" (aka 8:35 pm) on the previous day.  

I prefer the first intepretation, since it leads to more natural entries in stop_times.txt:

-3:25
-3:27
-3:29

aka the minute hand still moves forward as you check the stop-times of a particular trip.  But maybe the alternative makes more sense to people?

Brian
Reply all
Reply to author
Forward
0 new messages