Have unpacked datetime timezone being local

This commit is contained in:
cielavenir 2025-12-11 00:53:06 +09:00
parent 19b5d33ded
commit 3715b72d57
2 changed files with 5 additions and 2 deletions

View file

@ -355,10 +355,12 @@ static int unpack_callback_ext(unpack_user* u, const char* base, const char* pos
return -1;
}
py = PyNumber_Add(epoch, d);
PyObject *added = PyNumber_Add(epoch, d);
py = PyObject_CallMethod(added, "astimezone", "O", Py_None);
Py_DECREF(epoch);
Py_DECREF(d);
Py_DECREF(added);
}
else { // float
PyObject *a = PyFloat_FromDouble((double)ts.tv_nsec);