OneBusAway / onebusaway-application-modules

The core OneBusAway application suite.
https://github.com/OneBusAway/onebusaway-application-modules/wiki
Other
207 stars 132 forks source link

Vehicle status.lastLocationUpdateTime is seconds (instead of ms) past epoch #177

Open barbeau opened 8 years ago

barbeau commented 8 years ago

I got a report today from a user in Puget Sound that the "Last updated" time in the vehicle marker popup balloon is wrong in OBA Android:

image

Here's a sample trips-for-route API request: http://api.pugetsound.onebusaway.org/api/where/trips-for-route/1_102576.json?includeStatus=true&app_ver=62version=2&key=v1_BktoDJ2gJlu6nLM6LsT9H8IUbWc%3DcGF1bGN3YXR0c0BnbWFpbC5jb20%3D

...and a the status block from that response:

status: {
activeTripId: "1_30904954",
blockTripSequence: 12,
closestStop: "1_30570",
closestStopTimeOffset: -7,
distanceAlongTrip: 11774.797356666386,
frequency: null,
lastKnownDistanceAlongTrip: 0,
lastKnownLocation: {
lat: 47.58036422729492,
lon: -122.32905578613281
},
lastKnownOrientation: 0,
lastLocationUpdateTime: 1465348788,  // <-- Used to be milliseconds past epoch
lastUpdateTime: 1465348788000,
nextStop: "1_30590",
nextStopTimeOffset: 61,
orientation: 90,
phase: "in_progress",
position: {
lat: 47.58058676414876,
lon: -122.329063
},
predicted: true,
scheduleDeviation: 220,
scheduledDistanceAlongTrip: 11774.797356666386,
serviceDate: 1465282800000,
situationIds: [ ],
status: "default",
totalDistanceAlongTrip: 13179.505611838784,
vehicleId: "1_2710"
},

It looks like lastLocationUpdateTime went from being milliseconds past epoch (i.e., System.currentTimeMillis()) to seconds past epoch (i.e., POSIX time).

I'm guessing there was a server-side update recently that broke this? From some quick testing it looks like it's broken for all routes I've tested (randomly grabbed 5-6) in Puget Sound and Washington, D.C.

Also, just a guess - GTFS-realtime timestamps are POSIX time, it's possible the GTFS-rt timestamp is getting passed through to the OBA REST API unaltered?

@sheldonabrown Would you be able to roll out a fix for this quickly?

banshee commented 8 years ago

FYI, I'm the user who reported it. Feel free to ping me if you needed anything else.

sheldonabrown commented 8 years ago

Unfortunately I introduced this as part of: https://github.com/OneBusAway/onebusaway-application-modules/issues/151

This commit fixes it: https://github.com/camsys/onebusaway-application-modules/commit/e9dfd9dc599624dd0951beca0e6aefa0cefda5f1

The earliest I can roll this out is late next week -- it needs to go through change management. Is that sufficient?

Sheldon

On Tue, Jun 7, 2016 at 9:41 PM, Sean Barbeau notifications@github.com wrote:

I got a report today from a user in Puget Sound that the "Last updated" time in the vehicle marker popup balloon is wrong in OBA Android:

[image: image] https://cloud.githubusercontent.com/assets/928045/15880011/56bdfbca-2cf7-11e6-8597-4ba204c7f4bc.png

Here's a sample trips-for-route API request:

http://api.pugetsound.onebusaway.org/api/where/trips-for-route/1_102576.json?includeStatus=true&app_ver=62version=2&key=v1_BktoDJ2gJlu6nLM6LsT9H8IUbWc%3DcGF1bGN3YXR0c0BnbWFpbC5jb20%3D

...and a the status block from that response:

status: { activeTripId: "1_30904954", blockTripSequence: 12, closestStop: "1_30570", closestStopTimeOffset: -7, distanceAlongTrip: 11774.797356666386, frequency: null, lastKnownDistanceAlongTrip: 0, lastKnownLocation: { lat: 47.58036422729492, lon: -122.32905578613281 }, lastKnownOrientation: 0, lastLocationUpdateTime: 1465348788, // <-- Used to be milliseconds past epoch lastUpdateTime: 1465348788000, nextStop: "1_30590", nextStopTimeOffset: 61, orientation: 90, phase: "in_progress", position: { lat: 47.58058676414876, lon: -122.329063 }, predicted: true, scheduleDeviation: 220, scheduledDistanceAlongTrip: 11774.797356666386, serviceDate: 1465282800000, situationIds: [ ], status: "default", totalDistanceAlongTrip: 13179.505611838784, vehicleId: "1_2710" },

It looks like lastLocationUpdateTime went from being milliseconds past epoch (i.e., System.currentTimeMillis()) to seconds past epoch (i.e., POSIX time).

I'm guessing there was a server-side update recently that broke this? From some quick testing it looks like it's broken for all routes I've tested (randomly grabbed 5-6) in Puget Sound and Washington, D.C.

Also, just a guess - GTFS-realtime timestamps are POSIX time, it's possible the GTFS-rt timestamp is getting passed through to the OBA REST API unaltered?

@sheldonabrown https://github.com/sheldonabrown Would you be able to roll out a fix for this quickly?

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/177, or mute the thread https://github.com/notifications/unsubscribe/AA9JHb-t_TnyF3vGc1y9Fu6qPfK9jphXks5qJh23gaJpZM4IwhNx .

barbeau commented 8 years ago

Yes, that should work.

barbeau commented 8 years ago

Thanks for the fix!

sheldonabrown commented 8 years ago

The fix rolled out this morning.

barbeau commented 8 years ago

Thanks! From quick testing it looks like this is fixed in Puget Sound, but not WMATA in Washington, D.C. Is that expected?

sheldonabrown commented 8 years ago

Yes, sorry about that. Washington's fix will roll out Monday morning.

On Thu, Jun 16, 2016 at 9:48 AM, Sean Barbeau notifications@github.com wrote:

Thanks! From quick testing it looks like this is fixed in Puget Sound, but not WMATA in Washington, D.C. Is that expected?

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/177#issuecomment-226490162, or mute the thread https://github.com/notifications/unsubscribe/AA9JHW4wudqVYoPvGsVx6J3BM1Dp2CA4ks5qMVRDgaJpZM4IwhNx .

barbeau commented 8 years ago

Ok, thanks!

sheldonabrown commented 8 years ago

Washington rolled out.

barbeau commented 8 years ago

:+1: Do you want to close this issue now, or wait until https://github.com/camsys/onebusaway-application-modules/commit/e9dfd9dc599624dd0951beca0e6aefa0cefda5f1 is merged?

sheldonabrown commented 8 years ago

Good point! I was hoping the merge to master would take care of this, but that's stalled now on some build issues and code cleanup. (read: I haven't had time to get back to it).

I leave it to you -- I'm ok with keeping it open to remind us not to loose the commit.

On Tue, Jun 21, 2016 at 6:11 PM, Sean Barbeau notifications@github.com wrote:

šŸ‘ Do you want to close this issue now, or wait until camsys/onebusaway-application-modules@e9dfd9d https://github.com/camsys/onebusaway-application-modules/commit/e9dfd9dc599624dd0951beca0e6aefa0cefda5f1 is merged?

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/177#issuecomment-227588068, or mute the thread https://github.com/notifications/unsubscribe/AA9JHUfDhsHoV-EcDZdd9IL7mY0YMcPHks5qOGGVgaJpZM4IwhNx .

barbeau commented 8 years ago

I guess let's leave this open until the commit makes it here.