-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
posix clock: unexpected value for CLOCK_REALTIME when used with newlib #20167
Comments
I'm unable to reproduce this using what you provided as
Are you using some other platform? I think that would be an unsupported configuration (Zephyr's POSIX implementation surely can't co-exist with a host POSIX implementation) but defer to @pfalcon. |
i'm using nrf52840_mdk. Did you get 1 also using (posix/time.h): #include <zephyr.h>
#include <posix/time.h>
void main(void) {
printk("CLOCK_REALTIME: %ld\n", CLOCK_REALTIME);
} |
Sorry, I didn't read what you wrote here closely enough. Yes, I see the values are different. I suspect the best approach here would be to work #18892 so Zephyr only provides values that are not defined by a standard header provided by the toolchain. That would need to be scheduled based on POSIX subsystem needs. |
More specifically, I ack and confirm this issue. It's one of many conflicts related to Zephyr's POSIX subsystem, which get tracked and persistently fixed since the beginning of this year following the approach "POSIX subsys and libc should cooperate, not compete, and newlib should be used as a pattern/convention for libc interfacing (i.e. e.g. minlibc should behave/be structured as newlibc)". I've seen this particular issue before, but it was forgotten/lost while looking into other issue. It sufaced again while performing refactoring of #19114 based on its code review. Indeed, I would hope that the patch included there would fix the issue. I'm at a conference now though, so maybe be slow with confirming that the change also fixes this issue, so would appreciate independent verification. Thanks. |
It's working for me, thanks |
When compiling with newlib and posix clock enabled, and so using sys/time.h,
call to clock_settime will failed due to CLOCK_REALTIME having differente values
(0 in posix/clock.c file, 1 in main.c)
The text was updated successfully, but these errors were encountered: