-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fixes clock_gettime and rt_ktime_boottime_get_ns #10749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: Maihuanyi Changed Files (Click to expand)
🏷️ Tag: components_libcReviewers: GorrayLi mysterywolf Changed Files (Click to expand)
🏷️ Tag: kernelReviewers: GorrayLi ReviewSun hamburger-os lianux-mm wdfk-prog xu18838022837 Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-09-27 18:06 CST)
📝 Review Instructions
|
27bca35
to
5a4e198
Compare
0bc44ca
to
5839f13
Compare
38a4a7d
to
c448a01
Compare
Currently the return value of clock_gettime and rt_ktime_boottime_get_ns are restricted by rt_ktime_cputimer_getres, as the value of rt_ktime_cputimer_getres are not exactly represent the frequency of the clock, directly using rt_ktime_cputimer_getfrq will ensure the return value of rt_ktime_boottime_get_ns be more exact. And also add function rt_muldiv_u64 rt_muldiv_u32 for not losing precision when convert between cputimer and hrtimer and nanoseconds. Because rt_ktime_boottime_get_ns depends on rt_ktime_cputimer_getcnt and rt_ktime_cputimer_getcnt depends rt_tick_get So the rt_tick_t should be 64bit for long running program. Use `#if defined(ARCH_CPU_64BIT)` is for future allow rt_tick_t can be 64bit on 32bit CPU. Tick count should not be restricted to the CPU Signed-off-by: Yonggang Luo <[email protected]>
There is no user of it
c448a01
to
264c203
Compare
拉取/合并请求描述:(PR description)
continue work of #9008
Fixes overflow of
clock_gettime
rt_ktime_boottime_get_ns
thoroughlyCurrently the return value of clock_gettime and rt_ktime_boottime_get_ns are restricted by
rt_ktime_cputimer_getres
, as the value ofrt_ktime_cputimer_getres
are not exactly represent thefrequency of the clock
, directly usingrt_ktime_cputimer_getfrq
will ensure the return value of rt_ktime_boottime_get_ns be more exact.And also add function rt_muldiv_u64 rt_muldiv_u32 for not losing precision when convert between
cputimer
andhrtimer
andnanoseconds
.Because
rt_ktime_boottime_get_ns
depends onrt_ktime_cputimer_getcnt
andrt_ktime_cputimer_getcnt
dependsrt_tick_get
So the rt_tick_t should be 64bit for long running program.
Use
#if defined(ARCH_CPU_64BIT)
is forfuture allow rt_tick_t can be 64bit on 32bit CPU.
Tick count should not be restricted to the CPU
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up