New internal function OPENSSL_gmtime, which is intended to do the same
[openssl.git] / crypto / asn1 / a_gentm.c
index f884b25f968da52f0d0d3965e0f8e9ecb6a41012..ef95003510a9341048f9756ee2fc036fcf314176 100644 (file)
@@ -61,6 +61,7 @@
 #include <stdio.h>
 #include <time.h>
 #include "cryptlib.h"
+#include "o_time.h"
 #include <openssl/asn1.h>
 
 #if 0
@@ -193,21 +194,17 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
        {
        char *p;
        struct tm *ts;
-#if defined(THREADS) && !defined(WIN32)
        struct tm data;
-#endif
 
        if (s == NULL)
                s=M_ASN1_GENERALIZEDTIME_new();
        if (s == NULL)
                return(NULL);
 
-#if defined(THREADS) && !defined(WIN32)
-       gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
-       ts=&data;
-#else
-       ts=gmtime(&t);
-#endif
+       ts=OPENSSL_gmtime(&t, &data);
+       if (ts == NULL)
+               return(NULL);
+
        p=(char *)s->data;
        if ((p == NULL) || (s->length < 16))
                {