4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 12:59:21 +08:00

RISC-V: Fix timeval conversion in _gettimeofday()

Replace multiplication with division for microseconds calculation from
nanoseconds in _gettimeofday function.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
This commit is contained in:
Kuan-Wei Chiu 2023-11-29 11:57:14 +08:00 committed by Corinna Vinschen
parent dab15f6740
commit 5f15d7c581

View File

@ -23,7 +23,7 @@ _gettimeofday(struct timeval *tp, void *tzp)
int rv;
rv = syscall_errno (SYS_clock_gettime64, 2, 0, (long)&ts64, 0, 0, 0, 0);
tp->tv_sec = ts64.tv_sec;
tp->tv_usec = ts64.tv_nsec * 1000;
tp->tv_usec = ts64.tv_nsec / 1000;
return rv;
#else
return syscall_errno (SYS_gettimeofday, 1, tp, 0, 0, 0, 0, 0);