Get time since epoch in milliseconds, preferably using C++11 chrono
问题 All I want is to get the time since epoch in milliseconds and store it in an unsigned long. I found this related question. But honestly, this can't be the easiest way to perform such a simple task, is it? I am hoping for something much simpler, but can't find anything in the std::chrono reference. Any advice is most welcome. I don't necessarily have to use std::chrono , but I want it to be platform independent. 回答1: unsigned long milliseconds_since_epoch = std::chrono::system_clock::now()