diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index ee33f2e87..dde298150 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -701,7 +701,13 @@ inline Time Min (const Time &ta, const Time &tb) /** * \brief Time output streamer. * - * Generates output such as "3.96ns" + * Generates output such as "3.96ns". Times are printed with the + * following format flags (independent of the stream flags): + * - `showpos` + * - `fixed` + * - `left` + * The stream `width` and `precision` are ignored; Time output always + * includes ".0". * \relates ns3::Time */ std::ostream& operator<< (std::ostream& os, const Time & time); diff --git a/src/core/model/time.cc b/src/core/model/time.cc index a2e02a9df..95e237e51 100644 --- a/src/core/model/time.cc +++ b/src/core/model/time.cc @@ -424,6 +424,8 @@ operator<< (std::ostream& os, const Time & time) int64_t v = time.ToInteger (res); std::ios_base::fmtflags ff = os.flags (); + + os << std::setw (0) << std::left; { // See bug 1737: gcc libstc++ 4.2 bug if (v == 0) {