drivers/sensors/lis2dh: use realtime clock if monotonic is not available
This commit is contained in:
parent
325a5804f1
commit
a5cb1129f9
@ -1664,7 +1664,13 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev)
|
||||
int32_t diff_msec;
|
||||
uint8_t value;
|
||||
|
||||
/* Prefer monotonic for timeout calculation when enabled. */
|
||||
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
(void)clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
#else
|
||||
(void)clock_gettime(CLOCK_REALTIME, &start);
|
||||
#endif
|
||||
|
||||
/* Reboot to reset chip. */
|
||||
|
||||
@ -1689,7 +1695,11 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
(void)clock_gettime(CLOCK_MONOTONIC, &curr);
|
||||
#else
|
||||
(void)clock_gettime(CLOCK_REALTIME, &curr);
|
||||
#endif
|
||||
|
||||
diff_msec = (curr.tv_sec - start.tv_sec) * 1000;
|
||||
diff_msec += (curr.tv_nsec - start.tv_nsec) / (1000 * 1000);
|
||||
|
Loading…
Reference in New Issue
Block a user