Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  a
Language: C/C++
Code:
#include <iostream>
#include <vector>
#include <numeric>
#include <chrono>
#include <thread>

volatile int sink;
int main()
{
  auto end = std::chrono::steady_clock::now();
  std::chrono::duration<double> zeroDiff = end -end;
  for(int  i= 0; i < 399999999; i++){}
  auto start = std::chrono::steady_clock::now();
  std::chrono::duration<double> diff;
  do {
    end = std::chrono::steady_clock::now();
    diff = end-start;
  } while(diff==zeroDiff);
  std::cout << "Time  " << diff.count() << " s\n";
}
     
Comments: