clock: correct compile failed
LD: nuttx.elf ld: /home/ligd/platform/mainline/nuttx/staging/libsched.a(mq_sndinternal.o): in function `wd_start_realtime': /home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274: undefined reference to `clock_realtime2absticks' /home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274:(.text+0xad): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `clock_realtime2absticks' ld: /home/ligd/platform/mainline/nuttx/staging/libsched.a(mq_rcvinternal.o): in function `wd_start_realtime': /home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274: undefined reference to `clock_realtime2absticks' /home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274:(.text+0xad): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `clock_realtime2absticks' make[1]: *** [Makefile:128: nuttx.elf] Error 1 make: *** [tools/Unix.mk:551: nuttx.elf] Error 2 Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
07061d882c
commit
92f8f9b8f8
|
@ -26,6 +26,7 @@ set(SRCS
|
|||
clock_initialize.c
|
||||
clock_settime.c
|
||||
clock_gettime.c
|
||||
clock_realtime2absticks.c
|
||||
clock_systime_ticks.c
|
||||
clock_systime_timespec.c)
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
CSRCS += clock.c clock_initialize.c clock_settime.c clock_gettime.c
|
||||
CSRCS += clock_systime_ticks.c clock_systime_timespec.c
|
||||
CSRCS += clock_perf.c
|
||||
CSRCS += clock_perf.c clock_realtime2absticks.c
|
||||
|
||||
ifeq ($(CONFIG_CLOCK_TIMEKEEPING),y)
|
||||
CSRCS += clock_timekeeping.c
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* sched/clock/clock_abstime2ticks.c
|
||||
* sched/clock/clock_realtime2absticks.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -35,76 +35,6 @@
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_abstime2ticks
|
||||
*
|
||||
* Description:
|
||||
* Convert an absolute timespec delay to system timer ticks.
|
||||
*
|
||||
* Input Parameters:
|
||||
* clockid - The timing source to use in the conversion
|
||||
* reltime - Convert this absolute time to system clock ticks.
|
||||
* ticks - Return the converted number of ticks here.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; A non-zero error number on failure
|
||||
*
|
||||
* Assumptions:
|
||||
* Interrupts should be disabled so that the time is not changing during
|
||||
* the calculation
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int clock_abstime2ticks(clockid_t clockid,
|
||||
FAR const struct timespec *abstime,
|
||||
FAR sclock_t *ticks)
|
||||
{
|
||||
struct timespec currtime;
|
||||
struct timespec reltime;
|
||||
int ret;
|
||||
|
||||
/* Convert the timespec to clock ticks.
|
||||
* NOTE: Here we use internal knowledge
|
||||
* that CLOCK_REALTIME is defined to be zero!
|
||||
*/
|
||||
|
||||
ret = clock_gettime(clockid, &currtime);
|
||||
if (ret != OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (clock_timespec_compare(abstime, &currtime) < 0)
|
||||
{
|
||||
/* Every caller of clock_abstime2ticks check 'ticks < 0' to see if
|
||||
* absolute time is in the past. So lets just return negative tick
|
||||
* here.
|
||||
*/
|
||||
|
||||
*ticks = -1;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* The relative time to wait is the absolute time minus the current time. */
|
||||
|
||||
reltime.tv_nsec = (abstime->tv_nsec - currtime.tv_nsec);
|
||||
reltime.tv_sec = (abstime->tv_sec - currtime.tv_sec);
|
||||
|
||||
/* Check if we were supposed to borrow from the seconds. */
|
||||
|
||||
if (reltime.tv_nsec < 0)
|
||||
{
|
||||
reltime.tv_nsec += NSEC_PER_SEC;
|
||||
reltime.tv_sec -= 1;
|
||||
}
|
||||
|
||||
/* Convert this relative time into clock ticks. */
|
||||
|
||||
*ticks = clock_time2ticks(&reltime);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_realtime2absticks
|
||||
*
|
Loading…
Reference in New Issue