I saw several other answers to SO that suggest that we can get the time from the era in milliseconds by subtracting the time of the era from the “other” time, but it doesn't work when I try:
ptime epoch = time_from_string("1970-01-01 00:00:00.000");
ptime other = time_from_string("2011-08-09 17:27:00.000");
long diff = (other-epoch).total_milliseconds();
At this point, diff is 1349172576, and it should be a positive number since the “other” time is 2011. Does anyone know what could be causing this? What is the right way to get milliseconds from an era?
In addition, I tried to build a ptime object from milliseconds:
ptime result = from_time_t(diff);
The result will then be: "1927-Apr-01 13:50:24," and it should be "2011-Aug-09 17: 27: 00.000." What is the catch here?
Update:
, , 2 , - # (8 /64- ) ++ (4 /32- ); .
, long long, , ( from_time_t) - : "2012--02 10:09:36".