aboutsummaryrefslogtreecommitdiff
path: root/libgloss/riscv
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2023-11-29 11:57:14 +0800
committerCorinna Vinschen <corinna@vinschen.de>2023-11-29 10:14:55 +0100
commit5f15d7c5817b07a6b18cbab17342c95cb7b42be4 (patch)
tree6bee736d3d82e234aa613ac00ade9a501d3a183a /libgloss/riscv
parentdab15f6740ff73e8b17b7ddddcbb678895a916a2 (diff)
downloadnewlib-5f15d7c5817b07a6b18cbab17342c95cb7b42be4.zip
newlib-5f15d7c5817b07a6b18cbab17342c95cb7b42be4.tar.gz
newlib-5f15d7c5817b07a6b18cbab17342c95cb7b42be4.tar.bz2
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>
Diffstat (limited to 'libgloss/riscv')
-rw-r--r--libgloss/riscv/sys_gettimeofday.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgloss/riscv/sys_gettimeofday.c b/libgloss/riscv/sys_gettimeofday.c
index 81bea8e..5379a89 100644
--- a/libgloss/riscv/sys_gettimeofday.c
+++ b/libgloss/riscv/sys_gettimeofday.c
@@ -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);