rv32emu icon indicating copy to clipboard operation
rv32emu copied to clipboard

Fix the microsecond-to-nanosecond conversion in rv_clock_gettime()

Open alanjian85 opened this issue 1 year ago • 5 comments

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.

alanjian85 avatar Feb 26 '24 04:02 alanjian85

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.

jserv avatar Feb 26 '24 04:02 jserv

See: https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=5f15d7c5817b07a6b18cbab17342c95cb7b42be4

visitorckw avatar Feb 27 '24 15:02 visitorckw

Let's keep this pull request and wait for prebuilt GNU Toolchain for landing newlib fixes.

jserv avatar Feb 29 '24 17:02 jserv

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.

jserv avatar Apr 06 '24 11:04 jserv

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.

jserv avatar Apr 26 '24 03:04 jserv