#include<iostream>
#include<chrono>
#include<thread>
using namespace std;
void CheckDuration (std::chrono::duration<int> seconds)
{
auto start = std::chrono::system_clock::now() + seconds;
std::this_thread::sleep_for(std::chrono::seconds(1));
auto stop = std::chrono::system_clock::now();
cout << "Difference = " << std::chrono::duration_cast<std::chrono::seconds>(stop-start).count() << endl;
}
int main ()
{
CheckDuration(std::chrono::duration<int>(0)); // Difference = 1
CheckDuration(std::chrono::duration<int>(1)); // Difference = 0
CheckDuration(std::chrono::duration<int>(2)); // Difference = 0
CheckDuration(std::chrono::duration<int>(3)); // Difference = -1
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNocm9ubz4KI2luY2x1ZGU8dGhyZWFkPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBDaGVja0R1cmF0aW9uIChzdGQ6OmNocm9ubzo6ZHVyYXRpb248aW50PiBzZWNvbmRzKQp7CiAgYXV0byBzdGFydCA9IHN0ZDo6Y2hyb25vOjpzeXN0ZW1fY2xvY2s6Om5vdygpICsgc2Vjb25kczsKICBzdGQ6OnRoaXNfdGhyZWFkOjpzbGVlcF9mb3Ioc3RkOjpjaHJvbm86OnNlY29uZHMoMSkpOwogIGF1dG8gc3RvcCA9IHN0ZDo6Y2hyb25vOjpzeXN0ZW1fY2xvY2s6Om5vdygpOwoKICBjb3V0IDw8ICJEaWZmZXJlbmNlID0gIiA8PCBzdGQ6OmNocm9ubzo6ZHVyYXRpb25fY2FzdDxzdGQ6OmNocm9ubzo6c2Vjb25kcz4oc3RvcC1zdGFydCkuY291bnQoKSA8PCBlbmRsOwp9CgppbnQgbWFpbiAoKQp7CiAgQ2hlY2tEdXJhdGlvbihzdGQ6OmNocm9ubzo6ZHVyYXRpb248aW50PigwKSk7ICAvLyBEaWZmZXJlbmNlID0gMQogIENoZWNrRHVyYXRpb24oc3RkOjpjaHJvbm86OmR1cmF0aW9uPGludD4oMSkpOyAgLy8gRGlmZmVyZW5jZSA9IDAKICBDaGVja0R1cmF0aW9uKHN0ZDo6Y2hyb25vOjpkdXJhdGlvbjxpbnQ+KDIpKTsgIC8vIERpZmZlcmVuY2UgPSAwCiAgQ2hlY2tEdXJhdGlvbihzdGQ6OmNocm9ubzo6ZHVyYXRpb248aW50PigzKSk7ICAvLyBEaWZmZXJlbmNlID0gLTEKfQ==