Skip to content

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

Open
@barbeau

Description

@barbeau

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions