Skip to content

Commit

Permalink
Resolving issue CxxTest#101
Browse files Browse the repository at this point in the history
  • Loading branch information
jedeweb committed Aug 12, 2014
1 parent 191addd commit d2735e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cxxtest/XmlFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,21 @@ class XmlFormatter : public TestListener
{
std::string retVal;
const time_t now(time(NULL));
char current_date_string[27];

#ifdef WIN32
#ifdef _MSC_VER
char current_date_string[27];
if (ctime_s(current_date_string, sizeof(current_date_string)-1, &now) == 0)
{
retVal = current_date_string;
retVal.erase(retVal.find_last_not_of(" \n\r\t")+1); // trim trailing whitespace
}
#else
retVal.append(ctime(&now));
retVal.erase(retVal.find_last_not_of(" \n\r\t")+1); // trim trailing whitespace
#endif
#else
char current_date_string[27];
const size_t n = strlen(ctime_r(&now, current_date_string));
if (n)
{
Expand Down

0 comments on commit d2735e1

Please sign in to comment.