diff options
author | Tobias Brunner <tobias@strongswan.org> | 2009-04-30 11:37:54 +0000 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2009-04-30 11:37:54 +0000 |
commit | d24a74c5b4fb62b720a79b632021746b69de7c45 (patch) | |
tree | fd8854673b9d72059d7f9459a82663d5a70617ce /src/libstrongswan/asn1/asn1.c | |
parent | 466f11bfaf56c389947b2cbee6dd4f1fb56a821e (diff) | |
download | strongswan-d24a74c5b4fb62b720a79b632021746b69de7c45.tar.bz2 strongswan-d24a74c5b4fb62b720a79b632021746b69de7c45.tar.xz |
merging changes from portability branch back to trunk
important change for developers: %Y replaces %D to print identities!
Diffstat (limited to 'src/libstrongswan/asn1/asn1.c')
-rw-r--r-- | src/libstrongswan/asn1/asn1.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libstrongswan/asn1/asn1.c b/src/libstrongswan/asn1/asn1.c index de8c5ea4c..170095271 100644 --- a/src/libstrongswan/asn1/asn1.c +++ b/src/libstrongswan/asn1/asn1.c @@ -307,8 +307,8 @@ u_int asn1_length(chunk_t *blob) */ time_t asn1_to_time(const chunk_t *utctime, asn1_t type) { - struct tm t; - time_t tc, tz_offset; + struct tm t, local; + time_t tc, tz_offset, now; u_char *eot = NULL; if ((eot = memchr(utctime->ptr, 'Z', utctime->len)) != NULL) @@ -375,9 +375,16 @@ time_t asn1_to_time(const chunk_t *utctime, asn1_t type) /* convert to time_t */ tc = mktime(&t); + + if (tc == -1) + { + return TIME_MAX; + } /* if no conversion overflow occurred, compensate timezone */ - return (tc == -1) ? TIME_MAX : (tc - timezone - tz_offset); + now = time(NULL); + localtime_r(&now, &local); + return tc - local.tm_gmtoff - tz_offset; } /** |