-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix the microsecond-to-nanosecond conversion in rv_clock_gettime() #360
Conversation
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.
The issue with time conversion for |
Let's keep this pull request and wait for prebuilt GNU Toolchain for landing newlib fixes. |
Recent riscv-gnu-toolchain supports newlib 4.4.0, meaning that it is time to adopt this proposed change. Once the prebuilt GNU Toolchain for RISC-V is ready for downloading, I will merge this pull request and rebuild all ELF files. |
The Nightly: April 12, 2024 build should include newlib v4.4.0 already. |
Thank @alanjian85 for contributing! |
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.
A microsecond is 1000 times bigger than a nanosecond (10-6 vs 10-9 seconds). This commit corrects the conversion of microseconds to nanoseconds in
rv_clock_gettime()
by multiplyingtv_usec
by 1000 instead of dividing it.