diff options
| author | fengweihao <[email protected]> | 2021-04-02 10:19:44 +0800 |
|---|---|---|
| committer | fengweihao <[email protected]> | 2021-04-02 10:19:44 +0800 |
| commit | 02110480c447031952915975c96ed9e6acdd1daa (patch) | |
| tree | 02453c363808369be6429032de34b80db8436b75 | |
| parent | 981c2b6a5aa2a3fab7dbb68e622c30efada522b1 (diff) | |
修复设置时区影响日志时间问题
| -rw-r--r-- | program/src/cert_session.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/program/src/cert_session.cpp b/program/src/cert_session.cpp index 426eccc..8ec95d3 100644 --- a/program/src/cert_session.cpp +++ b/program/src/cert_session.cpp @@ -624,7 +624,8 @@ int add_ext(X509 *cacrt, X509 *cert, int nid, char *value) static time_t ASN1_GetTimeT(ASN1_TIME* time) { - struct tm t; + struct tm t; time_t utc_timep; + const char* str = (const char*) time->data; size_t i = 0; @@ -655,7 +656,10 @@ static time_t ASN1_GetTimeT(ASN1_TIME* time) /* Note: we did not adjust the time based on time zone information */ setenv("TZ", "UTC", 1); - return mktime(&t); + utc_timep = mktime(&t); + unsetenv("TZ"); + + return utc_timep; } void x509_get_private_ecc_key(EC_KEY *key1, char *pubkey) |
