Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.6] bpo-29063: tmtotuple(): use time_t for gmtoff (#1276) #1635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static PyTypeObject StructTimeType;
static PyObject *
tmtotuple(struct tm *p
#ifndef HAVE_STRUCT_TM_TM_ZONE
, const char *zone, int gmtoff
, const char *zone, time_t gmtoff
#endif
)
{
Expand All @@ -305,7 +305,7 @@ tmtotuple(struct tm *p
#else
PyStructSequence_SET_ITEM(v, 9,
PyUnicode_DecodeLocale(zone, "surrogateescape"));
SET(10, gmtoff);
PyStructSequence_SET_ITEM(v, 10, _PyLong_FromTime_t(gmtoff));
#endif /* HAVE_STRUCT_TM_TM_ZONE */
#undef SET
if (PyErr_Occurred()) {
Expand Down Expand Up @@ -397,7 +397,7 @@ time_localtime(PyObject *self, PyObject *args)
{
struct tm local = buf;
char zone[100];
int gmtoff;
time_t gmtoff;
strftime(zone, sizeof(zone), "%Z", &buf);
gmtoff = timegm(&buf) - when;
return tmtotuple(&local, zone, gmtoff);
Expand Down