#include <iostream>
#include <time.h>
#include <windows.h>
#include<chrono>
using namespace std;
using namespace std::chrono;
int main()
{
	struct timeval time1;
	/*cout << "秒:" << duration_cast<seconds>(system_clock::now ().time_since_epoch ()).count () << endl;
	cout << "毫秒:" << duration_cast<milliseconds>(system_clock::now ().time_since_epoch ()).count () << endl;
	cout << "微秒:" << duration_cast<microseconds>(system_clock::now ().time_since_epoch ()).count () << endl;
	cout << "纳秒:" << duration_cast<nanoseconds>(system_clock::now ().time_since_epoch ()).count () << endl;*/
	for (int i = 0; i < 100; i++)
	{
		int count = 0;
		int t1 = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
		//cout << "微秒:" << duration_cast<microseconds>(system_clock::now ().time_since_epoch ()).count () << endl;
		for (int j = 0; j < 120000; j++)
		{
			if (j % 3 == 0)
				if(j % 9 == 0)
					count += 1;
				else
					count += 2;
		}
		int t2 = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
		cout << t2 - t1 << endl;
		//cout << "微秒:" << duration_cast<microseconds>(system_clock::now ().time_since_epoch ()).count () << endl;
	}
	return 0;
}
更新于 阅读次数