Chrono System time Conversion to Since Epoch not working

Hi, I'm using boost 1.47 on Visual Studio 2008 and cannot seem to get the time since epoch from the Chrono library. At first I noticed that boost::chrono::system_time::now() does not have to be represented in time since epoch format so I don't believe that's an issue. However, I tried calling boost::chrono::system_time::now().time_since_epoch() and I get the same return result as if I was only referencing now(). That is, it is not time since epoch. Calling the static method to_time_t() DOES return proper time since epoch but it is in seconds (as time_t generally is) and is not what I'm looking for. Michael Chrostowski

Le 18/10/11 19:34, Michael Chrostowski a écrit :
Hi,
I'm using boost 1.47 on Visual Studio 2008 and cannot seem to get the time since epoch from the Chrono library.
At first I noticed that boost::chrono::system_time::now() does not have to be represented in time since epoch format so I don't believe that's an issue. However, I tried calling boost::chrono::system_time::now().time_since_epoch() and I get the same return result as if I was only referencing now(). That is, it is not time since epoch.
Calling the static method to_time_t() DOES return proper time since epoch but it is in seconds (as time_t generally is) and is not what I'm looking for.
Hi, the single difference between now() and now()::time_since_epoch() is that the first is a time_point, while the second is a duration. Could you post the code and your results, so we can see what is going wrong? Best, Vicente
participants (2)
-
Michael Chrostowski
-
Vicente J. Botet Escriba