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

interprocess_condition::timed_wait() requires time as universal_time, not local_time #237

Open
Tails86 opened this issue Oct 28, 2024 · 1 comment

Comments

@Tails86
Copy link

Tails86 commented Oct 28, 2024

Boost version: 1.86.0
OS: Linux, Ubuntu 22.04

I'm used to using boost::posix_time::microsec_clock::local_time() or std::chrono::steady_clock::now() as my time base for most boost timed wait functionality. However, it seems that interprocess_condition::timed_wait() returns false immediately for me when I have a time 1 second in the future (I am in UTC-7 time zone). Things start to work fine if I either adjust my system time to UTC+0 or update the code to instead use boost::posix_time::microsec_clock::universal_time() as my time base.

@Tails86
Copy link
Author

Tails86 commented Oct 28, 2024

If this is instead a misunderstanding on my end, I would like to see the documentation updated to clarify this.

The one area I have played around with where the type of clock used didn't seem to matter was with boost::asio::io_service::run_until() where I use an offset from std::chrono::steady_clock::now(). Since this is all a part of boost, I assumed I could just reference this code for interprocess code. Now that I'm looking more closely, boost::asio::io_service::run_until() uses const chrono::time_point< Clock, Duration > & abs_time, and interprocess_condition::timed_wait() uses const boost::posix_time::ptime & abs_time.

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

No branches or pull requests

1 participant