Another option is to round up the current time to the nearest second using ceil():
auto next_second = std::chrono::ceil<std::chrono::seconds>(
std::chrono::system_clock::now());
If you want to wait until this second has been reached before running some further code, you can add in:
std::this_thread::sleep_until(next_second);
(This code was based on https://en.cppreference.com/w/cpp/chrono/time_point/round, Bames53's response at https://stackoverflow.com/a/9747668/13097194, and https://en.cppreference.com/w/cpp/thread/sleep_until.html .)