Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
commit 81591155c2c754fbe07ef3cc21211c679d3f6369 2 parents 41a1e0b + f136a69
@skyshaw authored
Showing with 22 additions and 0 deletions.
  1. +18 −0 c-cpp/misc/c++11/chrono.cc
  2. +4 −0 c-cpp/misc/makefile
View
18 c-cpp/misc/c++11/chrono.cc
@@ -0,0 +1,18 @@
+#include <iostream>
+#include <chrono>
+
+using namespace std;
+using namespace std::chrono;
+
+int main() {
+ auto x = hours(2) + minutes(35) + seconds(9);
+ auto y = hours(3) + minutes(10) + seconds(1);
+ cout << x.count() << " " << y.count() << endl;
+ auto p = high_resolution_clock::now();
+ for (int i = 0; i < 10000; ++i)
+ ;
+ auto q = high_resolution_clock::now();
+ auto dura = q - p;
+ cout << dura.count() << endl;
+ return 0;
+}
View
4 c-cpp/misc/makefile
@@ -282,5 +282,9 @@ map:
thread:
g++ $(CPP11)/thread1.cc -o $(BIN)/thread.o -std=c++0x -lpthread
+.PHONY:
+chrono:
+ g++ $(CPP11)/chrono.cc -o $(BIN)/chrono.o -std=c++0x
+
clean:
rm *.o
Please sign in to comment.
Something went wrong with that request. Please try again.