returning to the previous localtime_r implementation that uses
localtime. The _localtime64_s implementation had issues, in that
it wanted to write to the "now" variable. (Should have been
passed "result" instead). Further, on MSVC (for which this replacement
is being considered) localtime redirects to _localtime64_s anyway.
For how Check is using localtime_r, just using localtime is
sufficient.
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1038
64e312b2-a51f-0410-8e61-
82d0ca0eb02a
check_function_exists(getpid HAVE_GETPID)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(localtime_r HAVE_DECL_LOCALTIME_R)
-check_function_exists(localtime_s HAVE_LOCALTIME_S)
check_function_exists(malloc HAVE_MALLOC)
check_function_exists(realloc HAVE_REALLOC)
check_function_exists(setenv HAVE_DECL_SETENV)
check_function_exists(strdup HAVE_DECL_STRDUP)
check_function_exists(strsignal HAVE_DECL_STRSIGNAL)
check_function_exists(_getpid HAVE__GETPID)
-check_function_exists(_localtime64_s HAVE__LOCALTIME64_S)
check_function_exists(_strdup HAVE__STRDUP)
# printf related checks
struct tm * localtime_r (const time_t *clock, struct tm *result)
{
- struct tm *now = NULL;
-
-#if HAVE_LOCALTIME_S
- localtime_s (now, clock)
-#elif HAVE__LOCALTIME64_S
- _localtime64_s (now, clock);
-#else
- now = localtime (clock);
-#endif /* !HAVE_LOCALTIME_S */
-
- if (now != NULL)
+ struct tm *now = localtime (clock);
+ if (now == NULL)
{
- *result = *now;
+ return NULL;
}
+ else
+ {
+ *result = *now;
+ }
+
return result;
}