#include #include #include #include #include #include //for read write, etc #include //for errno #include //for strerror and strerror_r #include #include "debug.h" /* * I don't prefix time localtime_r and strftime with std:: because lot's of implementaions are broken and it's an unnecessary purism * */ namespace xstream { namespace posix{ date_format::date_format(const std::string& f):format(f){}; std::string date_format::now() const{ LOG("posix::date_format::now"); ::time_t t; ::time(&t); struct std::tm tm; //XXX check error and throw exception ::localtime_r(&t,&tm); //first size of the allocated buffer //if needed it will be reallocated size_t len=512; std::string ret; do{ LOG("\tlen="< "< "<