summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_utctm.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-05-19 11:59:55 +0000
committerBodo Möller <bodo@openssl.org>2000-05-19 11:59:55 +0000
commit5569e1c39a9476838f6ea91fc37c2f8164398e6f (patch)
tree90c45065ee3df6a3c4ac9e4ab692818cd43e7cb4 /crypto/asn1/a_utctm.c
parent89269c84fe79a6e31b8a335f02fe3bb2dbaca69e (diff)
Add "FIXME" comment, and adjust the indentation.
Diffstat (limited to 'crypto/asn1/a_utctm.c')
-rw-r--r--crypto/asn1/a_utctm.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index e8d2836c58..379c30c769 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -266,30 +266,35 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
}
time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
- {
- struct tm tm;
- int offset;
+ {
+ struct tm tm;
+ int offset;
- memset(&tm,'\0',sizeof tm);
+ memset(&tm,'\0',sizeof tm);
#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
- tm.tm_year=g2(s->data);
- if(tm.tm_year < 50)
- tm.tm_year+=100;
- tm.tm_mon=g2(s->data+2)-1;
- tm.tm_mday=g2(s->data+4);
- tm.tm_hour=g2(s->data+6);
- tm.tm_min=g2(s->data+8);
- tm.tm_sec=g2(s->data+10);
- if(s->data[12] == 'Z')
- offset=0;
- else
- {
- offset=g2(s->data+13)*60+g2(s->data+15);
- if(s->data[12] == '-')
- offset= -offset;
- }
+ tm.tm_year=g2(s->data);
+ if(tm.tm_year < 50)
+ tm.tm_year+=100;
+ tm.tm_mon=g2(s->data+2)-1;
+ tm.tm_mday=g2(s->data+4);
+ tm.tm_hour=g2(s->data+6);
+ tm.tm_min=g2(s->data+8);
+ tm.tm_sec=g2(s->data+10);
+ if(s->data[12] == 'Z')
+ offset=0;
+ else
+ {
+ offset=g2(s->data+13)*60+g2(s->data+15);
+ if(s->data[12] == '-')
+ offset= -offset;
+ }
#undef g2
- return timegm(&tm)-offset*60;
- }
+ return timegm(&tm)-offset*60; /* FIXME: timegm is non-standard,
+ * typically we only have mktime (which
+ * interprets the struct tm according to
+ * the current time zone setting).
+ * Also time_t is inappropriate for general
+ * UTC times because it may a 32 bit type. */
+ }