zephyr/lib/posix
Ederson de Souza d83a649a67 lib/posix: Get uptime in ticks instead of cycles
__z_clock_nanosleep function was getting current time in cycles, via
k_cycle_get_32(), to perform its time calculations. However, when calling
k_sleep() to actually sleep, times are measured in ticks.

This causes a problem when there's a big skew between the uptime
measured in cycles vs uptime measured in ticks: in some platforms, the
system clock maybe up for a long time already when Zephyr starts
counting ticks, for instance, while downloading an image via PXE. In
this case, the calculations done inside __z_clock_nanosleep end up
measuring a much bigger current time than expected, thus sleeping too
much, basically all the time since system clock initialization.

This patch fixes that by avoiding the cycle trip: stick to ticks,
instead. They start counting from Zephyr initialization instead, which
is the expected uptime.

Fixes #69608

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-06-28 21:01:54 -04:00
..
options lib/posix: Get uptime in ticks instead of cycles 2024-06-28 21:01:54 -04:00
shell posix: deprecate POSIX_ENV _CONFSTR _SYSCONF and _UNAME 2024-06-04 16:27:12 -05:00
CMakeLists.txt lib: posix: shell: Fix compiler warning of lib__posix__shell 2024-03-15 06:30:31 -04:00
Kconfig posix: separate shell utilities and posix api implementation 2024-02-01 05:26:24 -05:00