diff --git a/arch/sim/src/sim/up_hosttime.c b/arch/sim/src/sim/up_hosttime.c index cf2be0bad5..21b09bfd76 100644 --- a/arch/sim/src/sim/up_hosttime.c +++ b/arch/sim/src/sim/up_hosttime.c @@ -85,6 +85,7 @@ void host_sleepuntil(uint64_t nsec) { base = now; } + now -= base; if (nsec > now + 1000) diff --git a/arch/sim/src/sim/up_oneshot.c b/arch/sim/src/sim/up_oneshot.c index 1c31ea11ea..4b5a2cb557 100644 --- a/arch/sim/src/sim/up_oneshot.c +++ b/arch/sim/src/sim/up_oneshot.c @@ -379,6 +379,7 @@ void up_timer_update(void) .tv_sec = 0, .tv_nsec = NSEC_PER_TICK, }; + FAR sq_entry_t *entry; clock_timespec_add(&g_current, &tick, &g_current); diff --git a/arch/sim/src/sim/up_rtc.c b/arch/sim/src/sim/up_rtc.c index 838d2056b7..726583f4e7 100644 --- a/arch/sim/src/sim/up_rtc.c +++ b/arch/sim/src/sim/up_rtc.c @@ -66,7 +66,6 @@ static int sim_rtc_rdtime(FAR struct rtc_lowerhalf_s *lower, uint64_t nsec; time_t sec; - nsec = host_gettime(true); sec = nsec / NSEC_PER_SEC; nsec -= sec * NSEC_PER_SEC; diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c index c1e191826b..5920d5907e 100644 --- a/drivers/timers/arch_alarm.c +++ b/drivers/timers/arch_alarm.c @@ -379,7 +379,7 @@ int up_alarm_start(FAR const struct timespec *ts) } #endif -/***************************************************************************** +/**************************************************************************** * Name: up_critmon_* * * Description: @@ -396,7 +396,7 @@ int up_alarm_start(FAR const struct timespec *ts) * * The second interface simple converts an elapsed time into well known * units. - *****************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SCHED_CRITMONITOR uint32_t up_critmon_gettime(void) diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h index 72177f11f1..d3d620df0d 100644 --- a/include/nuttx/clock.h +++ b/include/nuttx/clock.h @@ -1,8 +1,8 @@ /**************************************************************************** * include/nuttx/clock.h * - * Copyright (C) 2007-2009, 2011-2012, 2014, 2016-2018 Gregory Nutt. - All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2014, 2016-2018, 2020 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,7 @@ ****************************************************************************/ /* Configuration ************************************************************/ + /* Efficient, direct access to OS global timer variables will be supported * if the execution environment has direct access to kernel global data. * The code in this execution context can access the kernel global data @@ -71,23 +72,23 @@ #undef __HAVE_KERNEL_GLOBALS #if defined(CONFIG_SCHED_TICKLESS) - /* Case 1: There is no global timer data */ + /* Case 1: There is no global timer data */ #elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) - /* Case 3: Kernel mode of protected kernel build */ + /* Case 3: Kernel mode of protected kernel build */ # define __HAVE_KERNEL_GLOBALS 1 #elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__) - /* Case 3: Kernel only build */ + /* Case 3: Kernel only build */ # define __HAVE_KERNEL_GLOBALS 1 #elif defined(CONFIG_LIB_SYSCALL) - /* Case 4: Building with SYSCALLs enabled, but not part of a kernel build */ + /* Case 4: Building with SYSCALLs enabled, but not part of a kernel build */ #else - /* Case 2: Un-protected, non-kernel build */ + /* Case 2: Un-protected, non-kernel build */ # define __HAVE_KERNEL_GLOBALS 1 #endif @@ -252,6 +253,7 @@ extern "C" #endif /* Access to raw system clock ***********************************************/ + /* Direct access to the system timer/counter is supported only if (1) the * system timer counter is available (i.e., we are not configured to use * a hardware periodic timer), and (2) the execution environment has direct