I have been compiling someone else's code in VS2017, and stumbled across this warning:
Warning C4996 'localtime': This function or variable may be unsafe. Consider using localtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
So I have looked up localtime_s
and found it... twice:
struct tm *localtime_s(const time_t *restrict time, struct tm *restrict result);
errno_t localtime_s(
struct tm* _tm,
const time_t *time
);
Obviously, these are different. So now I wonder, if I replace localtime
by Microsoft's localtime_s
, who will be able to compile this code, and who won't? Isn't C standardized?