diff --git a/src/timegm.c b/src/timegm.c index b80e0789..62b14430 100644 --- a/src/timegm.c +++ b/src/timegm.c @@ -34,7 +34,7 @@ static int count_leap_year(int y) { } /* 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 num_leap_year; int64_t t; diff --git a/src/timegm.h b/src/timegm.h index 2624657a..4168fdd1 100644 --- a/src/timegm.h +++ b/src/timegm.h @@ -37,7 +37,7 @@ extern "C" { #include #endif // HAVE_TIME_H -time_t timegm(struct tm *tm); +time_t nghttp2_timegm(struct tm *tm); #ifdef __cplusplus } diff --git a/src/util.cc b/src/util.cc index 2d7c7734..191bd13f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -278,7 +278,7 @@ std::string common_log_date(time_t t) { #ifdef HAVE_STRUCT_TM_TM_GMTOFF auto gmtoff = tms.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 if (gmtoff >= 0) { *p++ = '+'; @@ -326,7 +326,7 @@ std::string iso8601_date(int64_t ms) { #ifdef HAVE_STRUCT_TM_TM_GMTOFF auto gmtoff = tms.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 if (gmtoff == 0) { *p++ = 'Z'; @@ -354,7 +354,7 @@ time_t parse_http_date(const std::string &s) { if (r == 0) { return 0; } - return timegm(&tm); + return nghttp2_timegm(&tm); } namespace {