std::future::wait_for calls __atomic_futex_unsigned._M_load_when_equal_for which calculates an absolute time measured against std::chrono::system_clock. This results in the timeout changing if the system clock is warped. std::future::wait_for should behave the same as std::condition_variable::wait_for and wait against std::chrono::steady_clock. Similarly, calling std::future::wait_until with a std::chrono::steady_clock parameter results in a wait against std::chrono::system_clock. (A fix for this is available in https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01932.html .)
Confirmed, thanks Mike.
An updated version of the fix is available in https://gcc.gnu.org/pipermail/libstdc++/2020-May/050433.html which relies on https://gcc.gnu.org/pipermail/libstdc++/2020-May/050439.html .
The patches mentioned in comment 2 landed for GCC 11 as 87fce1923fcc8d6ef508500475c149082dc9d338 and 01d412ef36f56c6961858f4d3d395d000e3f1c06 respectively. It seems that I failed to include the bug number in the commit message. :(
Thanks, Mike. I've added the PR number to the ChangeLog file in g:b98d3cc5666f36bf3cbeed7cd6a23483cc5e4eca