Hi, @RL Chen
I reproduced the problem:
Start the program, set the time back 5mins, and then set it to the current time. I still need to wait 5 minutes before the program continues.
For 2 days is set, the program will wait 2 days.
As David said, MSVC seems to use system clock.
You can submit reports on the Developer Community.
Window API is an alternative:
#include<Windows.h>
Such as
Sleep function is not affected by changing the system clock.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.