Skip to content

Commit bad5ad9

Browse files
authored
72: use uxr_nanos from Micro-XRCE-DDS-Client instead of clock_gettime for random seed generation (#73)
1 parent 830239f commit bad5ad9

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

rmw_microxrcedds_c/src/rmw_init.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <rmw/rmw.h>
2424
#include <rmw/error_handling.h>
2525
#include <rmw/allocators.h>
26+
#include <uxr/client/util/time.h>
2627

2728
#include "./callbacks.h"
2829

@@ -82,9 +83,7 @@ rmw_init_options_init(rmw_init_options_t * init_options, rcutils_allocator_t all
8283
}
8384
#endif
8485

85-
struct timespec ts;
86-
clock_gettime(CLOCK_REALTIME, &ts);
87-
srand((ts.tv_sec * 1000000000UL ) + ts.tv_nsec);
86+
srand(uxr_nanos());
8887

8988
do {
9089
init_options->impl->connection_params.client_key = rand();

0 commit comments

Comments
 (0)