Skip to content

Align TimeWithUnit printing to the "normal" double behaviour

Tommaso Pecorella requested to merge tommypec/ns-3-dev:TimePrint into master

This merge substitutes !419 (closed)

With respect to the old one, it does change how time is printed, only when using .As (Time::Unit).

The result is like this:

 0.0067  -0.0017   0.0017   1.1   10   1e+02
0.0067s -0.0017s 0.0017s 1.1s 10s 1e+02s
+0.00665999999999999996 -0.00166599999999999995 +0.00166599899999999998 +1.11099999899999999996 +10.11099999999999999998 +100.11099999999999999998

Where the first line is double printing, the second is time printed with .As (Time::Unit) and the 3rd is a time printed with .To (Time::Unit).

The latter (.To (Time::Unit)) is useful when the time must be printed without loss of precision (at the expense of extra numbers).

time-print.cc

Edited by Tommaso Pecorella

Merge request reports