On Thursday 29 September 2011 00:23:12 Troy Straszheim wrote: > Fixed in r15052, note this patch introduces a different bug: what if my > fill character were '-' before the call to operator<<, or if field width > were 17. boost io state savers to the rescue... The field width is only kept for the next insertion in the stream and then cleared again. Only the fill character permanently modifies the 'os' object in the code below. > > On Wed, Sep 28, 2011 at 7:56 AM, Ruben Smits > > wrote: > > Hi, > > > > I noticed that all space created with setw in an ostream gets filled > > zeros after a ros::Time object has been printed in the ostream. > > > > A patch is availble in the following ticket: > > https://code.ros.org/trac/ros/ticket/3693 > > > > It just resets the fill caracter to space after the time is printed: > > > > --- time.cpp.original 2011-09-28 16:48:45.000000000 +0200 > > +++ time.cpp 2011-09-28 16:41:41.000000000 +0200 > > @@ -311,13 +311,13 @@ > > > > std::ostream& operator<<(std::ostream& os, const Time &rhs) > > { > > > > - os << rhs.sec << "." << std::setw(9) << std::setfill('0') << > > rhs.nsec; + os << rhs.sec << "." << std::setw(9) << std::setfill('0') > > << rhs.nsec< > > > return os; > > > > } > > > > std::ostream& operator<<(std::ostream& os, const Duration& rhs) > > { > > > > - os << rhs.sec << "." << std::setw(9) << std::setfill('0') << > > rhs.nsec; + os << rhs.sec << "." << std::setw(9) << std::setfill('0') > > << rhs.nsec< > > > return os; > > > > } > > > > -- Ruben Peter