Skip to content

Commit

Permalink
update chrono中计时单位
Browse files Browse the repository at this point in the history
  • Loading branch information
liukai234 committed Apr 11, 2020
1 parent 7d37def commit f895c1b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions 并发编程/多线程在函数和lambda算子中.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2020-04-10 17:28:24
* @LastEditTime: 2020-04-10 18:50:14
* @LastEditTime: 2020-04-11 17:46:22
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /C++课程学习记录/thread多线程/intro.cpp
Expand Down Expand Up @@ -48,10 +48,11 @@ int main() {
t2.join();

auto stopTime = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stopTime - startTime);
auto duration = duration_cast<milliseconds>(stopTime - startTime);
// 1seconds = 1,000milliseconds 毫秒 = 1,000,000microseconds 微秒 = 1,000,000,000nanosecond 纳秒

cout << "EvenSum = " << EvenSum << endl;
cout << "OddSum = " << OddSum << endl;
cout << "duration = " << duration.count() / 1000000 << endl;
printf("%.2fs\n", float(duration.count()/1000.0));
return 0;
}

0 comments on commit f895c1b

Please sign in to comment.