Skip to content
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

Use sleep-aware monotonic clock if available #1189

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

bretambrose
Copy link
Contributor

aws/aws-iot-device-sdk-java-v2#608

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.23%. Comparing base (65be40d) to head (0a1e0f1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1189   +/-   ##
=======================================
  Coverage   84.23%   84.23%           
=======================================
  Files          57       57           
  Lines        5980     5980           
=======================================
  Hits         5037     5037           
  Misses        943      943           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Bret Ambrose and others added 2 commits March 10, 2025 14:34
#if defined(CLOCK_MONOTONIC_RAW)
#if defined(CLOCK_BOOTTIME)
# define HIGH_RES_CLOCK CLOCK_BOOTTIME
#elif defined(CLOCK_MONOTONIC_RAW)
# define HIGH_RES_CLOCK CLOCK_MONOTONIC_RAW
Copy link
Contributor

Choose a reason for hiding this comment

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

Previously we preferred CLOCK_MONOTONIC_RAW:
docs say:

Similar to CLOCK_MONOTONIC, but provides access to a raw hardware-based time that is not subject to NTP adjustments or the incremental adjustments performed by adjtime.

but with this change we'd prefer CLOCK_BOOTTIME, which days say:

Identical to CLOCK_MONOTONIC, except it also includes any time that the system is suspended.

So we'd be subject again to "NTP adjustments or the incremental adjustments performed by adjtime"

Just pointing it out. I don't know enough about this off the top of my head to gauge the full repercussions

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I just did some more reading on all this. BOOTTIME seems fine for our purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants