timers: add weak function up_timer_gettime()
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
e334df6d9a
commit
ccd87767da
|
@ -241,6 +241,18 @@ int weak_function up_timer_gettick(FAR clock_t *ticks)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int weak_function up_timer_gettime(struct timespec *ts)
|
||||
{
|
||||
int ret = -EAGAIN;
|
||||
|
||||
if (g_oneshot_lower != NULL)
|
||||
{
|
||||
ret = ONESHOT_CURRENT(g_oneshot_lower, ts);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -283,6 +283,20 @@ int weak_function up_timer_gettick(FAR clock_t *ticks)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int weak_function up_timer_gettime(struct timespec *ts)
|
||||
{
|
||||
int ret = -EAGAIN;
|
||||
|
||||
if (g_timer.lower != NULL)
|
||||
{
|
||||
ts->tv_sec = current_usec() / USEC_PER_SEC;
|
||||
ts->tv_nsec = (current_usec() % USEC_PER_SEC) * NSEC_PER_USEC;
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in New Issue