Use libmingwex for gmtime_s.

gmtime_s first appeared in MSVCR80, but libmingwex has a helper function
that tries to find the symbol or falls back to an internal
implementation.

(Patch by Kenny Root.)

Change-Id: I96ef9cd7459d7e8202831a4e687dfbc055c9f50b
Reviewed-on: https://boringssl-review.googlesource.com/4091
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/time_support.c b/crypto/time_support.c
index 0f2787c..9aa64ce 100644
--- a/crypto/time_support.c
+++ b/crypto/time_support.c
@@ -59,6 +59,12 @@
 #define _POSIX_C_SOURCE 201410L  /* for gmtime_r */
 #endif
 
+#if defined(__MINGW32__)
+#define MINGW_HAS_SECURE_API 1  /* supplied by libmingwex */
+#include <sec_api/time_s.h>  /* for correct definition of gmtime_s */
+#undef MINGW_HAS_SECURE_API
+#endif
+
 #include <openssl/time_support.h>
 
 #define SECS_PER_DAY (24 * 60 * 60)