Fix the microsecond-to-nanosecond conversion in rv_clock_gettime()
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 multiplying tv_usec by 1000 instead of dividing it.
The issue with time conversion for rv_clock_gettime has been resolved by @visitorckw, and it is expected that the fix would be included in newlib version 4.4. We need to verify that the prebuilt RISC-V toolchains, especially those maintained by SiFive, incorporate newlib-4.4 into their builds. Once confirmed, we will be able to mandate the proper approach for handling rv_clock_gettime.
See: https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=5f15d7c5817b07a6b18cbab17342c95cb7b42be4
Let's keep this pull request and wait for prebuilt GNU Toolchain for landing newlib fixes.
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.
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.