You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/02/22 17:23:24 UTC
[incubator-nuttx-apps] 01/02: Remove CONFIG_CLOCK_MONOTONIC special code
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit 4cc0c755bf1d20311d3ea3cea3f16d8b93b67a46
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Feb 15 16:16:54 2022 +0800
Remove CONFIG_CLOCK_MONOTONIC special code
since this opion doesn't exist anymore
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
examples/calib_udelay/Kconfig | 1 -
examples/canard/Kconfig | 2 +-
interpreters/wamr/Kconfig | 1 -
netutils/iperf/iperf.c | 9 ++-------
netutils/ntpclient/ntpclient.c | 9 ---------
nshlib/nsh_ddcmd.c | 8 --------
nshlib/nsh_timcmds.c | 10 ++--------
system/embedlog/Makefile | 5 -----
system/libuv/libuv/Kconfig | 1 -
9 files changed, 5 insertions(+), 41 deletions(-)
diff --git a/examples/calib_udelay/Kconfig b/examples/calib_udelay/Kconfig
index 2d809f9..c1759bc 100644
--- a/examples/calib_udelay/Kconfig
+++ b/examples/calib_udelay/Kconfig
@@ -6,7 +6,6 @@
config EXAMPLES_CALIB_UDELAY
tristate "Calibration tool for udelay"
default n
- select CLOCK_MONOTONIC
select LIBC_FLOATINGPOINT
---help---
Note that libm support is also required by this tool. You
diff --git a/examples/canard/Kconfig b/examples/canard/Kconfig
index 6595aee..888a756 100644
--- a/examples/canard/Kconfig
+++ b/examples/canard/Kconfig
@@ -6,7 +6,7 @@
config EXAMPLES_LIBCANARD
tristate "libcandard example"
default n
- depends on CANUTILS_LIBCANARD && CLOCK_MONOTONIC && SYSTEM_TIME64
+ depends on CANUTILS_LIBCANARD && SYSTEM_TIME64
---help---
Enable the LIBCANARD example
diff --git a/interpreters/wamr/Kconfig b/interpreters/wamr/Kconfig
index fc807e9..bf2f308 100644
--- a/interpreters/wamr/Kconfig
+++ b/interpreters/wamr/Kconfig
@@ -6,7 +6,6 @@
config INTERPRETERS_WAMR
tristate "Webassembly Micro Runtime"
default n
- select CLOCK_MONOTONIC
if INTERPRETERS_WAMR
diff --git a/netutils/iperf/iperf.c b/netutils/iperf/iperf.c
index 7b48431..44b362c 100644
--- a/netutils/iperf/iperf.c
+++ b/netutils/iperf/iperf.c
@@ -233,14 +233,9 @@ static void iperf_report_task(void *arg)
struct timespec start;
uintmax_t now_len;
int ret;
-#ifdef CONFIG_CLOCK_MONOTONIC
- const clockid_t clockid = CLOCK_MONOTONIC;
-#else
- const clockid_t clockid = CLOCK_REALTIME;
-#endif
now_len = s_iperf_ctrl.total_len;
- ret = clock_gettime(clockid, &now);
+ ret = clock_gettime(CLOCK_MONOTONIC, &now);
if (ret != 0)
{
fprintf(stderr, "clock_gettime failed\n");
@@ -258,7 +253,7 @@ static void iperf_report_task(void *arg)
last_len = now_len;
last = now;
now_len = s_iperf_ctrl.total_len;
- ret = clock_gettime(clockid, &now);
+ ret = clock_gettime(CLOCK_MONOTONIC, &now);
if (ret != 0)
{
fprintf(stderr, "clock_gettime failed\n");
diff --git a/netutils/ntpclient/ntpclient.c b/netutils/ntpclient/ntpclient.c
index 2f44d79..c3c32a0 100644
--- a/netutils/ntpclient/ntpclient.c
+++ b/netutils/ntpclient/ntpclient.c
@@ -542,18 +542,14 @@ static void ntpc_settime(int64_t offset, FAR struct timespec *start_realtime,
{
struct timespec tp;
struct timespec curr_realtime;
-#ifdef CONFIG_CLOCK_MONOTONIC
struct timespec curr_monotonic;
int64_t diffms_real;
int64_t diffms_mono;
int64_t diff_diff_ms;
-#endif
/* Get the system times */
clock_gettime(CLOCK_REALTIME, &curr_realtime);
-
-#ifdef CONFIG_CLOCK_MONOTONIC
clock_gettime(CLOCK_MONOTONIC, &curr_monotonic);
/* Check differences between monotonic and realtime. */
@@ -583,9 +579,6 @@ static void ntpc_settime(int64_t offset, FAR struct timespec *start_realtime,
return;
}
-#else
- UNUSED(start_monotonic);
-#endif
/* Apply offset */
@@ -1293,9 +1286,7 @@ static int ntpc_daemon(int argc, FAR char **argv)
CONFIG_NETUTILS_NTPCLIENT_NUM_SAMPLES);
clock_gettime(CLOCK_REALTIME, &start_realtime);
-#ifdef CONFIG_CLOCK_MONOTONIC
clock_gettime(CLOCK_MONOTONIC, &start_monotonic);
-#endif
/* Collect samples. */
diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c
index 2c1e901..ee800f7 100644
--- a/nshlib/nsh_ddcmd.c
+++ b/nshlib/nsh_ddcmd.c
@@ -300,11 +300,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Then perform the data transfer */
#ifdef CONFIG_NSH_CMDOPT_DD_STATS
-#ifdef CONFIG_CLOCK_MONOTONIC
clock_gettime(CLOCK_MONOTONIC, &ts0);
-#else
- clock_gettime(CLOCK_REALTIME, &ts0);
-#endif
#endif
dd.sector = 0;
@@ -353,11 +349,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
ret = OK;
#ifdef CONFIG_NSH_CMDOPT_DD_STATS
-#ifdef CONFIG_CLOCK_MONOTONIC
clock_gettime(CLOCK_MONOTONIC, &ts1);
-#else
- clock_gettime(CLOCK_REALTIME, &ts1);
-#endif
elapsed = (((uint64_t)ts1.tv_sec * NSEC_PER_SEC) + ts1.tv_nsec);
elapsed -= (((uint64_t)ts0.tv_sec * NSEC_PER_SEC) + ts0.tv_nsec);
diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c
index 0685b78..cd20373 100644
--- a/nshlib/nsh_timcmds.c
+++ b/nshlib/nsh_timcmds.c
@@ -38,12 +38,6 @@
#define MAX_TIME_STRING 80
-#ifdef CONFIG_CLOCK_MONOTONIC
-# define TIME_CLOCK CLOCK_MONOTONIC
-#else
-# define TIME_CLOCK CLOCK_REALTIME
-#endif
-
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@@ -303,7 +297,7 @@ int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Get the current time */
- ret = clock_gettime(TIME_CLOCK, &start);
+ ret = clock_gettime(CLOCK_MONOTONIC, &start);
if (ret < 0)
{
nsh_error(vtbl, g_fmtcmdfailed, argv[0], "clock_gettime", NSH_ERRNO);
@@ -329,7 +323,7 @@ int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Get and print the elapsed time */
- ret = clock_gettime(TIME_CLOCK, &end);
+ ret = clock_gettime(CLOCK_MONOTONIC, &end);
if (ret < 0)
{
nsh_error(vtbl, g_fmtcmdfailed,
diff --git a/system/embedlog/Makefile b/system/embedlog/Makefile
index dea4160..5535d4a 100644
--- a/system/embedlog/Makefile
+++ b/system/embedlog/Makefile
@@ -48,12 +48,7 @@ CSRCS = $(EMBEDLOG_SOURCES)/src/el-options.c \
ifeq ($(CONFIG_EMBEDLOG_ENABLE_TIMESTAMP),y)
CFLAGS += -DENABLE_TIMESTAMP
CFLAGS += -DENABLE_REALTIME
-
-ifeq ($(CONFIG_CLOCK_MONOTONIC),y)
CFLAGS += -DENABLE_MONOTONIC
-else
- CFLAGS += -DENABLE_MONOTONIC=0
-endif
endif
ifeq ($(CONFIG_EMBEDLOG_ENABLE_FRACTIONS),y)
diff --git a/system/libuv/libuv/Kconfig b/system/libuv/libuv/Kconfig
index 22cb439..76e8f78 100644
--- a/system/libuv/libuv/Kconfig
+++ b/system/libuv/libuv/Kconfig
@@ -29,7 +29,6 @@ config LIBUV_ASYNC
config LIBUV_TIMER
bool "libuv software timers support"
default n
- select CLOCK_MONOTONIC
---help---
Enable software timers support in libuv.