File tree Expand file tree Collapse file tree
rclcpp/include/rclcpp/experimental Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,16 +203,15 @@ class SubscriptionIntraProcess
203203 msg_info.publisher_gid = {0 , {0 }};
204204 msg_info.from_intra_process = true ;
205205
206- std::chrono::time_point<std::chrono::system_clock> now;
206+ const auto nanos = std::chrono::time_point_cast<std::chrono::nanoseconds>(
207+ std::chrono::system_clock::now ());
207208 if (stats_handler_) {
208209 RCLCPP_WARN_ONCE (
209210 rclcpp::get_logger (" rclcpp" ),
210211 " Intra-process communication does not support accurate message age statistics" );
211- now = std::chrono::system_clock::now ();
212212 // Set source_timestamp to "now" so that message_age reports 0ms rather than
213213 // an invalid value taken from an un-initialised timestamp. IPC delivery
214214 // has little/no transport latency by definition, so near-zero age is expected.
215- const auto nanos = std::chrono::time_point_cast<std::chrono::nanoseconds>(now);
216215 msg_info.source_timestamp = nanos.time_since_epoch ().count ();
217216 }
218217
@@ -229,7 +228,6 @@ class SubscriptionIntraProcess
229228 shared_ptr.reset ();
230229
231230 if (stats_handler_) {
232- const auto nanos = std::chrono::time_point_cast<std::chrono::nanoseconds>(now);
233231 stats_handler_ (msg_info, rclcpp::Time (nanos.time_since_epoch ().count ()));
234232 }
235233 }
You can’t perform that action at this time.
0 commit comments