#include<iostream>
#include<chrono>
using namespace std;
int main ()
{
cout << "now = " << chrono::duration_cast<chrono::microseconds>
(chrono::high_resolution_clock::now().time_since_epoch()).count() << "\n";
}
Above simple program compiled with clang++ (or g++) is returning wrong output in my Macbook Air Sierra as:
now = 28536840800
The same code runs fine in Ubuntu [also Windows, Android ...], with the proper output as:
now = 1503667687247859
Upon checking the standard library header file, the microseconds::rep
size is 8 bytes (long long
).
What is wrong with Mac machine?