Skip to content

Instantly share code, notes, and snippets.

@ycyvonne
Last active March 15, 2019 07:48
Show Gist options
  • Save ycyvonne/3cd87a72bfb0bdcca7ca581c13367eff to your computer and use it in GitHub Desktop.
Save ycyvonne/3cd87a72bfb0bdcca7ca581c13367eff to your computer and use it in GitHub Desktop.
#include<iostream>
#include<chrono>
int main()
{
auto start = std::chrono::system_clock::now();
auto end = std::chrono::system_clock::now();
while((std::chrono::duration_cast<std::chrono::seconds>(end - start).count() != 2))
{
end = std::chrono::system_clock::now();
cout<<"Time is"<<std::chrono::duration_cast<std::chrono::seconds>(end - start).count()<<" second"<<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment