Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b51fb87

Browse files
author
Arnd R. Strube
committed
VS problem. localtime_s appears to be OK.
1 parent 248dd80 commit b51fb87

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Platforms/VisualCpp/UtestPlatform.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ void SetPlatformSpecificTimeInMillisMethod(long (*platformSpecific) ())
8181

8282
static const char* TimeStringImplementation()
8383
{
84-
time_t tm = time(NULL);
84+
time_t the_time = time(NULL);
85+
struct tm the_local_time;
8586
static char dateTime[80];
86-
struct tm *tmp = localtime(&tm);
87-
strftime(dateTime, 80, "%Y-%m-%dT%H:%M:%S", tmp);
87+
localtime_s(&the_local_time, &the_time);
88+
strftime(dateTime, 80, "%Y-%m-%dT%H:%M:%S", &the_local_time);
8889
return dateTime;
8990
}
9091

0 commit comments

Comments
 (0)