The localtime_s and asctime_s are extensions for Microsoft provided by (some versions of) the MS runtime library. This is provided by the MS header files. Since these are MS copyrights and are not permitted for free distribution, mingw provides its own versions of headers - and they probably do not contain these extensions (they certainly did not help when I used mingw on my local machine - my main machine in these Linux days working ...).
Note that casting the time value to time32_t * is probably a bad idea - it will almost certainly bite you if you ever compile your code with time_t , which is not a 32-bit value.
The localtime_r function is a semi-standard version that can be used instead of localtime_s (you need to pay attention to 32 versus 64-bit time values). You can also use localtime (besides having to disable MS, the annoying "this function is unsafe, use ..._s instead" - I DO NOT REALLY want to convert 100 uses of strcpy to strcpy_s, which work fine, because it has already been tested elsewhere )
Similarly, there is asctime_r , which provides a re-version.
You could perhaps also add prototypes for these functions to your file somewhere, I believe that if you are compiling for Windows, solve the problem:
Link to MS function documentation: localtime_s and asctime_s .
source share