> On Mar 14, 2018, at 15:08, Travis Place <
travi...@gmail.com> wrote:
> What I wanted to achieve was, the results to show the time the Ferry (in my case) is meant to leave/arrive, and then a delay amount, so I could show something like "10:00am" as its meant to with a little "+5 min" next to it in red, for example.
I thought this was how most/all OTP clients display the information. You’ll probably want to examine how the default client does this. The routing API response should certainly contain enough information to reconstruct the 10:00 +5min representation.
> I think changing startTime to include the realtime delays, without still giving access to the correct time is strange. I would have expected startTime and startTimeAdjusted or something, or at least some way to still access the time the service was meant to arrive/depart.
The startTime in a routing response is meant to describe the time the passenger would leave the station, not the schedule. From the source code comments (which should show up in the API docs automatically):
/**
* For transit leg, the offset from the scheduled departure-time of the boarding stop in this leg.
* "scheduled time of departure at boarding stop" = startTime - departureDelay
*/
public int departureDelay = 0;
/**
* For transit leg, the offset from the scheduled arrival-time of the alighting stop in this leg.
* "scheduled time of arrival at alighting stop" = endTime - arrivalDelay
*/
public int arrivalDelay = 0;
So you can just subtract the departureDelay from the startTime.
> As for the rounding, I'd do that for display purposes in my app, so i can do "+5 mins" as an example, not "+4mins 56secs”
The contents of the API response are not meant to be displayed raw to the user. They are in seconds to provide the necessary precision in cases where the API consumer may need it. Typically a client would perform division to show minutes and seconds.
-Andrew