MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_timer_gettime

Function sys_timer_gettime

components/lwp/lwp_syscall.c:3180–3193  ·  view source on GitHub ↗

* @brief Retrieves the current time and interval of a timer. * * This system call fetches the current expiration time (`it_value`) and interval (`it_interval`) * of a previously created timer. It allows the caller to determine the current state of the timer, * whether it is one-shot or periodic, and the remaining time before expiration. * * @param[in] timerid The ID of the timer to que

Source from the content-addressed store, hash-verified

3178 * will result in errors.
3179 */
3180sysret_t sys_timer_gettime(timer_t timerid, struct itimerspec *curr_value)
3181{
3182 int ret = 0;
3183#ifdef ARCH_MM_MMU
3184
3185 struct itimerspec curr_value_k;
3186 lwp_get_from_user(&curr_value_k, (void *)curr_value, sizeof curr_value_k);
3187 ret = timer_gettime(timerid, &curr_value_k);
3188 lwp_put_to_user(curr_value, (void *)&curr_value_k, sizeof curr_value_k);
3189#else
3190 ret = timer_gettime(timerid, curr_value);
3191#endif
3192 return (ret < 0 ? GET_ERRNO() : ret);
3193}
3194
3195/**
3196 * @brief Retrieves the overrun count for a periodic timer.

Callers

nothing calls this directly

Calls 3

lwp_get_from_userFunction · 0.85
timer_gettimeFunction · 0.85
lwp_put_to_userFunction · 0.85

Tested by

no test coverage detected