Make Time printer ignore stream flags.

This commit is contained in:
Peter D. Barnes, Jr.
2014-01-10 17:22:45 -08:00
parent 27967f1c68
commit 472839ca28
2 changed files with 9 additions and 1 deletions

View File

@@ -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);

View File

@@ -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)
{