mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-06 18:18:52 +08:00
src: Rename timegm as nghttp2_timegm
This commit is contained in:
@@ -34,7 +34,7 @@ static int count_leap_year(int y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Based on the algorithm of Python 2.7 calendar.timegm. */
|
/* Based on the algorithm of Python 2.7 calendar.timegm. */
|
||||||
time_t timegm(struct tm *tm) {
|
time_t nghttp2_timegm(struct tm *tm) {
|
||||||
int days;
|
int days;
|
||||||
int num_leap_year;
|
int num_leap_year;
|
||||||
int64_t t;
|
int64_t t;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ extern "C" {
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif // HAVE_TIME_H
|
#endif // HAVE_TIME_H
|
||||||
|
|
||||||
time_t timegm(struct tm *tm);
|
time_t nghttp2_timegm(struct tm *tm);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ std::string common_log_date(time_t t) {
|
|||||||
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
||||||
auto gmtoff = tms.tm_gmtoff;
|
auto gmtoff = tms.tm_gmtoff;
|
||||||
#else // !HAVE_STRUCT_TM_TM_GMTOFF
|
#else // !HAVE_STRUCT_TM_TM_GMTOFF
|
||||||
auto gmtoff = timegm(&tms) - t;
|
auto gmtoff = nghttp2_timegm(&tms) - t;
|
||||||
#endif // !HAVE_STRUCT_TM_TM_GMTOFF
|
#endif // !HAVE_STRUCT_TM_TM_GMTOFF
|
||||||
if (gmtoff >= 0) {
|
if (gmtoff >= 0) {
|
||||||
*p++ = '+';
|
*p++ = '+';
|
||||||
@@ -326,7 +326,7 @@ std::string iso8601_date(int64_t ms) {
|
|||||||
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
||||||
auto gmtoff = tms.tm_gmtoff;
|
auto gmtoff = tms.tm_gmtoff;
|
||||||
#else // !HAVE_STRUCT_TM_TM_GMTOFF
|
#else // !HAVE_STRUCT_TM_TM_GMTOFF
|
||||||
auto gmtoff = timegm(&tms) - sec;
|
auto gmtoff = nghttp2_timegm(&tms) - sec;
|
||||||
#endif // !HAVE_STRUCT_TM_TM_GMTOFF
|
#endif // !HAVE_STRUCT_TM_TM_GMTOFF
|
||||||
if (gmtoff == 0) {
|
if (gmtoff == 0) {
|
||||||
*p++ = 'Z';
|
*p++ = 'Z';
|
||||||
@@ -354,7 +354,7 @@ time_t parse_http_date(const std::string &s) {
|
|||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return timegm(&tm);
|
return nghttp2_timegm(&tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
Reference in New Issue
Block a user