#include "common.h" #include #include #include namespace Debug { tm now() { time_t now = time(0); return *localtime(&now); } #ifdef _WIN32 std::wostream& formatDateTime(std::wostream& out, const tm& t, const wchar_t* fmt) { const std::time_put& dateWriter = std::use_facet >(out.getloc()); const size_t n = wcslen(fmt); #else std::ostream& formatDateTime(std::ostream& out, const tm& t, const char* fmt) { const std::time_put& dateWriter = std::use_facet >(out.getloc()); const size_t n = strlen(fmt); #endif dateWriter.put(out, out, ' ', &t, fmt, fmt + n); return out; } }