date_time: << operator for time_duration
Hello, one short question regarding the 'operator<<' on time_durations (which in turn calls 'duration_put' in time_formatting_streams.hpp): The stream's filler is changed via the manipulator 'std::setfill' to zero ('0'), but without setting it back to the one the stream had when entering to this function (in my case blank (' ')). This results in undesired leading blanks on the subsequent usage of the same stream object. Question: Is it a bug or is it the common way how streams are used (which would mean that is't up to me resetting it to blank again). Thank you in advance! -- Donato Petrino
On Wed, 15 Jun 2005 13:09:53 -0400, Donato Petrino wrote
Hello,
one short question regarding the 'operator<<' on time_durations (which in turn calls 'duration_put' in time_formatting_streams.hpp):
The stream's filler is changed via the manipulator 'std::setfill' to zero ('0'), but without setting it back to the one the stream had when entering to this function (in my case blank (' ')). This results in undesired leading blanks on the subsequent usage of the same stream object.
Question: Is it a bug or is it the common way how streams are used (which would mean that is't up to me resetting it to blank again).
Thank you in advance!
This is a bug in 1.32. The i/o code has been rewritten for 1.33 and this problem is fixed. In addition, the i/o is much more flexible because you can use format strings to adjust the output however you like with the streaming operator: time_facet* timefacet = new time_facet("%A %B %d %H:%M:%S"); std::cout.imbue(std::locale(std::locale::classic(), timefacet)); date d(2005,Apr, 20); ptime t1(d, hours(23)+minutes(59)+seconds(59)); std::cout << t1 << std::endl; //output: Wednesday April 20 23:59:59 I expect 1.33 will be released in the next few weeks. Jeff
participants (2)
-
Donato Petrino
-
Jeff Garland