Generating time data string
std::basic_string<charT, traits> format_time()
{
time_t ltime;
time(<ime);
std::basic_stringstream<charT, traits> time;
time << asctime(gmtime(<ime));
std::basic_stringstream<charT, traits> result;
result << time.str().erase(time.str().length()-1)
<<" - ";
return result.str();
}
There are many ways to generate a time date string and the exact method is beyond the scope of this presentation. However, here is an implementation that will work for both char and wchar_t. It returns the appropriately formatted string.