From 7f98f9a7505e8fef52b3b6161b59101962501943 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 18 Jun 2022 13:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D=E7=9A=84?= =?UTF-8?q?=E8=8E=B7=E5=8F=96gmt=20offset=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Http/HttpCookie.cpp | 22 +--------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 065b7562..cbc78f7f 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 065b75623da5f9bb5916cecd853936a6670d71c5 +Subproject commit cbc78f7f1a7d5d5b1a0060f72e30ee042d4d4779 diff --git a/src/Http/HttpCookie.cpp b/src/Http/HttpCookie.cpp index 579c3542..07594453 100644 --- a/src/Http/HttpCookie.cpp +++ b/src/Http/HttpCookie.cpp @@ -29,26 +29,6 @@ void HttpCookie::setHost(const string &host) { _host = host; } -static long s_gmtoff = 0; //时间差 -static onceToken s_token([]() { -#ifdef _WIN32 - TIME_ZONE_INFORMATION tzinfo; - DWORD dwStandardDaylight; - long bias; - dwStandardDaylight = GetTimeZoneInformation(&tzinfo); - bias = tzinfo.Bias; - if (dwStandardDaylight == TIME_ZONE_ID_STANDARD) { - bias += tzinfo.StandardBias; - } - if (dwStandardDaylight == TIME_ZONE_ID_DAYLIGHT) { - bias += tzinfo.DaylightBias; - } - s_gmtoff = -bias * 60; //时间差(分钟) -#else - s_gmtoff = getLocalTime(time(nullptr)).tm_gmtoff; -#endif // _WIN32 -}); - // from https://gmbabar.wordpress.com/2010/12/01/mktime-slow-use-custom-function/#comment-58 static time_t time_to_epoch(const struct tm *ltm, int utcdiff) { const int mon_days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; @@ -74,7 +54,7 @@ static time_t timeStrToInt(const string &date) { struct tm tt; strptime(date.data(), "%a, %b %d %Y %H:%M:%S %Z", &tt); // mktime内部有使用互斥锁,非常影响性能 - return time_to_epoch(&tt, s_gmtoff / 3600); // mktime(&tt); + return time_to_epoch(&tt, getGMTOff() / 3600); // mktime(&tt); } void HttpCookie::setExpires(const string &expires, const string &server_date) {