a_utctm.c (100928) | a_utctm.c (100936) |
---|---|
1/* crypto/asn1/a_utctm.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 256 unchanged lines hidden (view full) --- 265#endif 266 return(s); 267 } 268 269 270int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) 271 { 272 struct tm *tm; | 1/* crypto/asn1/a_utctm.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 256 unchanged lines hidden (view full) --- 265#endif 266 return(s); 267 } 268 269 270int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) 271 { 272 struct tm *tm; |
273#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) && !defined(_DARWIN) 274 struct tm data; 275#endif |
|
273 int offset; 274 int year; 275 276#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0') 277 278 if (s->data[12] == 'Z') 279 offset=0; 280 else 281 { 282 offset = g2(s->data+13)*60+g2(s->data+15); 283 if (s->data[12] == '-') 284 offset = -offset; 285 } 286 287 t -= offset*60; /* FIXME: may overflow in extreme cases */ 288 289#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) && !defined(_DARWIN) | 276 int offset; 277 int year; 278 279#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0') 280 281 if (s->data[12] == 'Z') 282 offset=0; 283 else 284 { 285 offset = g2(s->data+13)*60+g2(s->data+15); 286 if (s->data[12] == '-') 287 offset = -offset; 288 } 289 290 t -= offset*60; /* FIXME: may overflow in extreme cases */ 291 292#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) && !defined(_DARWIN) |
290 { struct tm data; gmtime_r(&t, &data); tm = &data; } | 293 gmtime_r(&t, &data); 294 tm = &data; |
291#else 292 tm = gmtime(&t); 293#endif 294 295#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1 296 year = g2(s->data); 297 if (year < 50) 298 year += 100; --- 50 unchanged lines hidden --- | 295#else 296 tm = gmtime(&t); 297#endif 298 299#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1 300 year = g2(s->data); 301 if (year < 50) 302 year += 100; --- 50 unchanged lines hidden --- |