سؤال

I am using boost::format variable to get elapsed time in seconds

boost::posix_time::time_duration  total_time = start_1.elapsed();
long milliseconds = total_time.total_milliseconds();
boost::format output("%.6f");
output % (milliseconds/1000.0);

But I use the timer several times to cumulate durations. I want to know with which type of variable can I cumulate durations ( use the operator +). For example with a float by I don't know how to convert from boost::format to float

Thanks in advance

هل كانت مفيدة؟

المحلول

According to the documentation documentation, time_duration has operator +. So it is possible to use time_duration itself to accumulate durations.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top