#include <cstdio>
#include "boost/date_time/posix_time/posix_time.hpp"
int main(int argc, char** argv) {
boost::posix_time::ptime start =
boost::posix_time::microsec_clock::local_time();
uint32_t iterations = 0;
// Do a bunch of work. `iterations` becomes > 0
boost::posix_time::ptime now =
boost::posix_time::microsec_clock::local_time();
boost::posix_time::time_duration diff = now - start;
printf("Milliseconds per iteration: %f\n",
static_cast<float>(diff.total_milliseconds()) / iterations);
return 0;
}
这打印出一个负值。怎么会这样?