Can I specify setprecision to round double values when stream to std output?
ofile << std::setprecision(12) << total_run_time/TIME << \"\\n
Another approach is to defeat the rounding by subtracting, in your second case, 0.000005 from the double before outputting it:
double
total_run_time / TIME - 0.000005
In many ways I prefer this as it avoids the potential for integer overflow.