diff --git a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp index 24b777c75f..6087bfa526 100644 --- a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp +++ b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp @@ -58,6 +58,8 @@ bool VehiclePropertyStore::writeValue(const VehiclePropValue& propValue, return false; } // update the propertyValue. + // The timestamp in propertyStore should only be updated by the server side. It indicates + // the time when the event is generated by the server. valueToUpdate->timestamp = propValue.timestamp; valueToUpdate->value = propValue.value; if (updateStatus) { diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp index 6d5f23f7fc..a983c7117d 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp @@ -126,7 +126,9 @@ VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get( *outStatus = v != nullptr ? StatusCode::OK : StatusCode::INVALID_ARG; break; } - + if (v.get()) { + v->timestamp = elapsedRealtimeNano(); + } return v; } @@ -283,6 +285,7 @@ void EmulatedVehicleHal::onContinuousPropertyTimer(const std::vector& p } if (v.get()) { + v->timestamp = elapsedRealtimeNano(); doHalEvent(std::move(v)); } }