mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
sched/clock: Remove CLOCK_MONOTONIC option from Kconfig
here is the reason: 1.clock_systime_timespec(core function) always exist regardless the setting 2.CLOCK_MONOTONIC is a foundamental clock type required by many places Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -643,11 +643,7 @@ static int bmp280_fetch(FAR struct sensor_lowerhalf_s *lower,
|
||||
temp = bmp280_compensate_temp(priv, temp);
|
||||
press = bmp280_compensate_press(priv, press);
|
||||
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
#endif
|
||||
|
||||
baro_data.timestamp = 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
|
||||
baro_data.pressure = press / 100.0f;
|
||||
|
||||
@@ -549,12 +549,8 @@ static int ds18b20_set_alarm(FAR struct ds18b20_dev_s *dev,
|
||||
static unsigned long ds18b20_curtime(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
#endif
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,12 +187,8 @@ static void hyt271_temp_from_rawdata(FAR struct hyt271_sensor_data_s *data,
|
||||
static unsigned long hyt271_curtime(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
#endif
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
|
||||
@@ -1667,11 +1667,7 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev)
|
||||
|
||||
/* Prefer monotonic for timeout calculation when enabled. */
|
||||
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
#endif
|
||||
|
||||
/* Reboot to reset chip. */
|
||||
|
||||
@@ -1696,11 +1692,7 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &curr);
|
||||
#else
|
||||
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);
|
||||
|
||||
@@ -157,12 +157,8 @@ static const struct sensor_ops_s g_sensor_ops =
|
||||
static unsigned long ms5611_curtime(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
#endif
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,17 +105,12 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
|
||||
#elif defined(CONFIG_CLOCK_MONOTONIC)
|
||||
#else
|
||||
/* Prefer monotonic when enabled, as it can be synchronized to
|
||||
* RTC with clock_resynchronize.
|
||||
*/
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
#else
|
||||
/* Otherwise, fall back to the system timer */
|
||||
|
||||
clock_systime_timespec(&ts);
|
||||
#endif
|
||||
|
||||
/* Prepend the message with the current time, if available */
|
||||
|
||||
Reference in New Issue
Block a user