summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Library/2024-04-30-12-59-04.gh-issue-101732.29zUDu.rst1
-rw-r--r--Modules/_ssl.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-04-30-12-59-04.gh-issue-101732.29zUDu.rst b/Misc/NEWS.d/next/Library/2024-04-30-12-59-04.gh-issue-101732.29zUDu.rst
new file mode 100644
index 0000000..354dfc4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-04-30-12-59-04.gh-issue-101732.29zUDu.rst
@@ -0,0 +1 @@
+Use a Y2038 compatible openssl time function when available.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index f7fdbf4..885a9c2 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -5329,7 +5329,11 @@ PySSLSession_clear(PySSLSession *self)
static PyObject *
PySSLSession_get_time(PySSLSession *self, void *closure) {
+#if OPENSSL_VERSION_NUMBER >= 0x30300000L
+ return _PyLong_FromTime_t(SSL_SESSION_get_time_ex(self->session));
+#else
return PyLong_FromLong(SSL_SESSION_get_time(self->session));
+#endif
}
PyDoc_STRVAR(PySSLSession_get_time_doc,