Skip to content

Commit 27567cd

Browse files
authored
Merge pull request cpputest#1156 from CFlix/iarTimeNewlineFix
IAR: Fix spurious newline after time in JUnit output.
2 parents 2b45d38 + 75b33e9 commit 27567cd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/Platforms/Iar/UtestPlatform.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ static long TimeInMillisImplementation()
115115
static const char* TimeStringImplementation()
116116
{
117117
time_t tm = time(NULL);
118-
return ctime(&tm);
118+
char* pTimeStr = ctime(&tm);
119+
char* newlineChar = strchr(pTimeStr, '\n'); // Find the terminating newline character.
120+
if(newlineChar != NULL) *newlineChar = '\0'; //If newline is found replace it with the string terminator.
121+
return (pTimeStr);
119122
}
120123

121124
long (*GetPlatformSpecificTimeInMillis)() = TimeInMillisImplementation;

0 commit comments

Comments
 (0)