mirror of
https://github.com/apache/nuttx.git
synced 2026-08-17 17:43:22 +08:00
up_timer_gettime() computed tv_sec and tv_nsec from two separate calls to current_usec(), which returns a free-running microsecond counter. The counter advances between the two calls, so a read that straddles a second boundary yields an inconsistent (possibly backwards) timespec. Read current_usec() once into a local variable and derive both fields from that single snapshot. Signed-off-by: yushuailong <yyyusl@qq.com>