-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Copy link
Labels
area: POSIXPOSIX API LibraryPOSIX API LibrarybugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug
Milestone
Description
Describe the bug
Although it is a boundary, before the 64-bit tick counter rolls-over, the value of the monotonic clock (seconds field) should equal UINT64_MAX / CONFIG_SYS_CLOCK_TICKS_PER_SEC (integer division).
Currently, it seems to be off by an order of magnitude (test case provided in PR).
Please also mention any information which could help others to understand
the problem you're facing:
- What target platform are you using? all
- What have you tried to diagnose or workaround this issue? written a test case
- Is this a regression? If yes, have you been able to "git bisect" it to a
specific commit? No
To Reproduce
Steps to reproduce the behavior:
- apply changes in referenced PR
- un-apply changes to
lib/posix/clock.c west build -p auto -b qemu_x86_64 -t run tests/posix/common- See error
Expected behavior
*** Booting Zephyr OS build zephyr-v3.2.0-2459-gdffb02fd134e ***
Running TESTSUITE posix_apis
===================================================================
START - test_clock_gettime_rollover
CONFIG_SYS_CLOCK_TICKS_PER_SEC: 100
rollover_s: 184467440737095516
t-1: {184467440737095516, 140000000}
t+0: {184467440737095516, 150000000}
t+1: {0, 0}
PASS - test_clock_gettime_rollover in 0.063 seconds
===================================================================
Impact
That really depends on the application. It can be an annoyance for some but a showstopper for others.
Logs and console output
*** Booting Zephyr OS build zephyr-v3.2.0-2459-gdffb02fd134e ***
Running TESTSUITE posix_apis
===================================================================
START - test_clock_gettime_rollover
CONFIG_SYS_CLOCK_TICKS_PER_SEC: 100
rollover_s: 184467440737095516
t-1: {18446744073709551, 596000000}
Assertion failed at WEST_TOPDIR/zephyr/tests/posix/common/src/clock.c:169: posix_apis_test_clock_gettime_rollover: rollover_s not equal to ts[0].tv_sec
FAIL - test_clock_gettime_rollover in 0.025 seconds
===================================================================
Environment (please complete the following information):
- OS: (e.g. Linux, MacOS, Windows): any
- Toolchain (e.g Zephyr SDK, ...): Zephyr SDK 0.15.2
- Commit SHA or Version used: bba9fc9
Additional context
This issue was encountered while writing tests to verify the fixes in
Metadata
Metadata
Assignees
Labels
area: POSIXPOSIX API LibraryPOSIX API LibrarybugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug