Skip to content

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Aug 31, 2025

This PR updates POSIX test files to use the realtime clock (CLOCK_REALTIME) instead of the monotonic clock (CLOCK_MONOTONIC) to ensure compatibility with systems that only guarantee availability of the realtime clock under _POSIX_TIMERS.

  • Replaces CLOCK_MONOTONIC with CLOCK_REALTIME in timing-related test functions
  • Adds #include <time.h> to both test files to ensure proper clock type definitions

Required by #88547

Use the realtime clock, since that is always guaranteed to be available
with _POSIX_TIMERS.

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt requested review from ycsin and loicpoulain August 31, 2025 13:40
@cfriedt cfriedt added area: Tests Issues related to a particular existing or missing test area: POSIX POSIX API Library labels Aug 31, 2025
@cfriedt cfriedt added this to the v4.3.0 milestone Aug 31, 2025
Copy link

@cfriedt cfriedt requested a review from Copilot September 2, 2025 01:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates POSIX test files to use the realtime clock (CLOCK_REALTIME) instead of the monotonic clock (CLOCK_MONOTONIC) to ensure compatibility with systems that only guarantee availability of the realtime clock under _POSIX_TIMERS.

  • Replaces CLOCK_MONOTONIC with CLOCK_REALTIME in timing-related test functions
  • Adds #include <time.h> to both test files to ensure proper clock type definitions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/posix/common/src/pthread.c Updates clock type in pthread timedjoin test and adds time.h include
tests/posix/common/src/mutex.c Updates clock type in mutex timedlock test and adds time.h include

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@fabiobaltieri fabiobaltieri merged commit a4498bd into zephyrproject-rtos:main Sep 8, 2025
29 checks passed
@cfriedt cfriedt deleted the tests-posix-use-realtime-clock-instead-of-monotonic branch September 8, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants