We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5a7a62 commit 5d39bb8Copy full SHA for 5d39bb8
1 file changed
c/tests/stress.c
@@ -14,6 +14,13 @@
14
#define M_INEQ_MAX 1000
15
#define M_NLCON 200
16
17
+// Thread-safe version of localtime
18
+#ifdef _WIN32
19
+#define localtime_safe(a, b) localtime_s(a, b)
20
+#else
21
+#define localtime_safe(a, b) localtime_r(b, a)
22
+#endif
23
+
24
int n = 0;
25
int m_ineq = 0;
26
const double alpha = 4.0;
@@ -67,7 +74,7 @@ unsigned int get_random_seed(void)
67
74
char buf[10] = {0};
68
75
time_t t = time(NULL);
69
76
struct tm timeinfo;
70
- localtime_s(&timeinfo, &t);
77
+ localtime_safe(&timeinfo, &t);
71
78
int rc = strftime(buf, 10, "%y%W", &timeinfo);
72
79
if (!rc)
73
80
return 42;
0 commit comments