It seems that mktime does what is required here. Certainly timegm() can
[openssl.git] / crypto / asn1 / a_utctm.c
index e8d2836c58a999cf29a22c1a34901839ec61c982..b855867dc1d30693bff1e8aa925f95884d64eccc 100644 (file)
@@ -266,30 +266,30 @@ 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 mktime(&tm)-offset*60;
+       }