Skip to content

core: (fixes #277) enable autoscaling of unit with Time::As() printer

Peter Barnes requested to merge pdbj/ns-3-dev:time-as-auto into master

This patch creates a new Time::Unit enum value: Time::AUTO. Time::As(Time::Unit) now defaults to AUTO.

In AUTO TimeWithUnit chooses the largest unit which will still result in a floating value with something left of the decimal.

In other words

  std::cout << Seconds (60).As () << std::endl;
  std::cout << Seconds (31415).As () << std::endl;

prints out

+1min
+8.7264h

Merge request reports