Where are the different versions of localtime_s used in C?

499 views Asked by At

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:

cppreference.com

struct tm *localtime_s(const time_t *restrict time, struct tm *restrict result);

msdn.microsoft.com

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?

0

There are 0 answers