]> git.sur5r.net Git - openocd/blobdiff - src/target/cortex_m.c
Use timeval helpers
[openocd] / src / target / cortex_m.c
index 24063a7e6af06dc49bbf083cb0c72a6f05226dcc..79af632ac7faca703292f02055072b1fb033738a 100644 (file)
@@ -1787,8 +1787,7 @@ int cortex_m_profiling(struct target *target, uint32_t *samples,
 
 
                gettimeofday(&now, NULL);
-               if (sample_count >= max_num_samples ||
-                       (now.tv_sec >= timeout.tv_sec && now.tv_usec >= timeout.tv_usec)) {
+               if (sample_count >= max_num_samples || timeval_compare(&now, &timeout) > 0) {
                        LOG_INFO("Profiling completed. %" PRIu32 " samples.", sample_count);
                        break;
                }