
[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <47729C6C.3090409@crystalclearsoftware.com> thusly:
But here's some example code:
#include "boost/date_time.hpp" #include <iostream>
using namespace boost::posix_time; using namespace boost::gregorian;
int main() {
ptime t1(date(2007, Dec, 26), hours(1) + seconds(5) + milliseconds(9));
time_facet* timefacet = new time_facet("%a, %d %b %Y %H:%M:%S %z"); std::cout.imbue(std::locale(std::locale::classic(), timefacet));
std::cout << t1 << std::endl; //Wed, 26 Dec 2007 01:00:05 }
I am always amazed when people superfluously use new. I am willing to bet that superfluous use of new is responsible for quite a number of C++ memory leaks and heap thrashing. Try: int main() { ptime t1(date(2007, Dec, 26), hours(1) + seconds(5) + milliseconds(9)); time_facet timefacet("%a, %d %b %Y %H:%M:%S %z"); std::cout.imbue(std::locale(std::locale::classic(), &timefacet)); std::cout << t1 << std::endl; //Wed, 26 Dec 2007 01:00:05 } -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://www.xmission.com/~legalize/book/download/index.html Legalize Adulthood! http://blogs.xmission.com/legalize/