summaryrefslogtreecommitdiffstats
path: root/Include/pytime.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-04-09 08:23:12 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-04-09 08:23:12 (GMT)
commit88ed640fc7aec18c6148525801186264ebef8a75 (patch)
tree95b04e27c6f3fa2fd2c91531e352d60ab06759c4 /Include/pytime.h
parentda5cbe65ae2cf43164ce4ba8e3b47d7b8c15c013 (diff)
downloadcpython-88ed640fc7aec18c6148525801186264ebef8a75.zip
cpython-88ed640fc7aec18c6148525801186264ebef8a75.tar.gz
cpython-88ed640fc7aec18c6148525801186264ebef8a75.tar.bz2
Issue #23834: Fix the default socket timeout
Use -1 second by default, not -1 nanosecond.
Diffstat (limited to 'Include/pytime.h')
-rw-r--r--Include/pytime.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/Include/pytime.h b/Include/pytime.h
index bf0dcd8..027c3d8 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -67,7 +67,12 @@ PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
/* Create a timestamp from a number of seconds. */
-PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int ns);
+PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds);
+
+/* Macro to create a timestamp from a number of seconds, no integer overflow.
+ Only use the macro for small values, prefer _PyTime_FromSeconds(). */
+#define _PYTIME_FROMSECONDS(seconds) \
+ ((_PyTime_t)(seconds) * (1000 * 1000 * 1000))
/* Create a timestamp from a number of nanoseconds. */
PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(PY_LONG_LONG ns);