We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 213978f commit 1f5ea5cCopy full SHA for 1f5ea5c
rclrs/src/time_source.rs
@@ -117,9 +117,10 @@ impl TimeSource {
117
(last_msg.clock.sec as i64 * 1_000_000_000) + last_msg.clock.nanosec as i64;
118
Self::update_clock(&clock, nanoseconds);
119
}
120
- // TODO(luca) this would allow duplicates to be stored in the vector but it seems other
121
- // client libraries do the same, should we check and no-op if the value exists already?
122
- self._clocks.lock().unwrap().push(clock);
+ let mut clocks = self._clocks.lock().unwrap();
+ if !clocks.iter().any(|c| Arc::ptr_eq(c, &clock)) {
+ clocks.push(clock);
123
+ }
124
Ok(())
125
126
0 commit comments