long otherTimestamp = otherUpdate.getTimestamp(); if (vp.getTimestamp() > otherTimestamp) { vehiclePositionsByVehicleId.put(vehicleId, vp); long time = vp.hasTimestamp() ? vp.getTimestamp() * 1000 : currentTime(); BlockDescriptor bd = getTripDescriptorAsBlockDescriptor(result, td, time);
long vehicleTimestamp = vehiclePosition.getTimestamp();
gpsTime = vehicle.getTimestamp()*Time.MS_PER_SEC; else { logger.warn("For vehicleId={} GPS time not available in "
if (entity.hasVehicle()) { if (entity.getVehicle().hasTimestamp()) { timestamp = entity.getVehicle().getTimestamp() * 1000;
setTimestamp(other.getTimestamp());
private void applyVehiclePositionToRecord(MonitoredResult result, BlockDescriptor blockDescriptor, VehiclePosition vehiclePosition, VehicleLocationRecord record) { Position position = vehiclePosition.getPosition(); if (vehiclePosition.hasTimestamp()) { record.setTimeOfLocationUpdate(TimeUnit.SECONDS.toMillis(vehiclePosition.getTimestamp())); //vehicle timestamp is in seconds } record.setCurrentLocationLat(position.getLatitude()); record.setCurrentLocationLon(position.getLongitude()); if (result != null) { result.addLatLon(position.getLatitude(), position.getLongitude()); } if (_scheduleAdherenceFromLocation) { CoordinatePoint location = new CoordinatePoint(position.getLatitude(), position.getLongitude()); double totalDistance = blockDescriptor.getBlockInstance().getBlock().getTotalBlockDistance(); long timestamp = vehiclePosition.hasTimestamp() ? record.getTimeOfLocationUpdate() : record.getTimeOfRecord(); ScheduledBlockLocation loc = _blockGeospatialService.getBestScheduledBlockLocationForLocation( blockDescriptor.getBlockInstance(), location, timestamp, 0, totalDistance); long serviceDateTime = record.getServiceDate(); long effectiveScheduleTime = loc.getScheduledTime() + (serviceDateTime/1000); double deviation = timestamp/1000 - effectiveScheduleTime; double oldDeviation = record.getScheduleDeviation(); record.setScheduleDeviation(deviation); _log.debug("deviation reset to {} from {} for vehicle {}", deviation, oldDeviation, vehiclePosition.getVehicle().getId()); } }
private void cacheVehicleLocations(FeedMessage vehiclePositions) { for (FeedEntity entity : vehiclePositions.getEntityList()) { if (entity.hasVehicle()) { GtfsRealtime.VehiclePosition vehicle = entity.getVehicle(); _vehicleLocationListener.handleRawPosition( new AgencyAndId(getAgencyIds().get(0), vehicle.getVehicle().getId()), vehicle.getPosition().getLatitude(), vehicle.getPosition().getLongitude(), vehicle.getTimestamp()); } } }
setTimestamp(other.getTimestamp());