Skip to content

Commit 047ba47

Browse files
visitorckwLapshin
authored andcommitted
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 <[email protected]>
1 parent 124f0c7 commit 047ba47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libgloss/riscv/sys_gettimeofday.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _gettimeofday(struct timeval *tp, void *tzp)
2323
int rv;
2424
rv = syscall_errno (SYS_clock_gettime64, 2, 0, (long)&ts64, 0, 0, 0, 0);
2525
tp->tv_sec = ts64.tv_sec;
26-
tp->tv_usec = ts64.tv_nsec * 1000;
26+
tp->tv_usec = ts64.tv_nsec / 1000;
2727
return rv;
2828
#else
2929
return syscall_errno (SYS_gettimeofday, 1, (long)tp, 0, 0, 0, 0, 0);

0 commit comments

Comments
 (0)