Skip to content

Commit a8aa29e

Browse files
authored
Fix the microsecond-to-nanosecond conversion (#360)
A microsecond is 1000 times bigger than a nanosecond (1e-6 vs 1e-9 seconds). This commit corrects the conversion of microseconds to nanoseconds in rv_clock_gettime() by multiplying tv_usec by 1000 instead of dividing it.
1 parent b8e20f6 commit a8aa29e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void rv_clock_gettime(struct timespec *tp)
6969
int32_t tv_sec, tv_usec;
7070
get_time_info(&tv_sec, &tv_usec);
7171
tp->tv_sec = tv_sec;
72-
tp->tv_nsec = tv_usec / 1000; /* Transfer to microseconds */
72+
tp->tv_nsec = tv_usec * 1000; /* Transfer to microseconds */
7373
}
7474

7575
char *sanitize_path(const char *input)

0 commit comments

Comments
 (0)