summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_time.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2001-05-16 08:44:09 +0000
committerRichard Levitte <levitte@openssl.org>2001-05-16 08:44:09 +0000
commitb8e35bd66e4d3d94c10091f6773afc4314ffcc80 (patch)
treec3b6c21b1aea7b90058cd547cadfe1843aeec4db /crypto/asn1/a_time.c
parente8734731d3b39cf3f7fa6acb055d22e0bdc2a7ff (diff)
New internal function OPENSSL_gmtime, which is intended to do the same
as gmtime_r() on the systems where that is defined.
Diffstat (limited to 'crypto/asn1/a_time.c')
-rw-r--r--crypto/asn1/a_time.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c
index 266614d14f..27ddd30899 100644
--- a/crypto/asn1/a_time.c
+++ b/crypto/asn1/a_time.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <time.h>
#include "cryptlib.h"
+#include "o_time.h"
#include <openssl/asn1t.h>
IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
@@ -100,14 +101,11 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
{
struct tm *ts;
-#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__)
struct tm data;
- gmtime_r(&t,&data);
- ts=&data; /* should return &data, but doesn't on some systems, so we don't even look at the return value */
-#else
- ts=gmtime(&t);
-#endif
+ ts=OPENSSL_gmtime(&t,&data);
+ if (ts == NULL)
+ return NULL;
if((ts->tm_year >= 50) && (ts->tm_year < 150))
return ASN1_UTCTIME_set(s, t);
return ASN1_GENERALIZEDTIME_set(s,t);