bpo-31904: Port the time module on VxWorks (GH-12305) · python/cpython@f1464f4 (original) (raw)
`@@ -145,7 +145,7 @@ perf_counter(_Py_clock_info_t *info)
`
145
145
`return _PyFloat_FromPyTime(t);
`
146
146
`}
`
147
147
``
148
``
`-
#if defined(MS_WINDOWS) || defined(HAVE_CLOCK)
`
``
148
`+
#if (defined(MS_WINDOWS) || defined(HAVE_CLOCK)) && !defined(VXWORKS)
`
149
149
`#define PYCLOCK
`
150
150
`static PyObject*
`
151
151
`pyclock(_Py_clock_info_t *info)
`
`@@ -765,7 +765,7 @@ time_strftime(PyObject *self, PyObject *args)
`
765
765
`return NULL;
`
766
766
` }
`
767
767
``
768
``
`-
#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX)
`
``
768
`+
#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) || defined(VXWORKS)
`
769
769
`if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) {
`
770
770
`PyErr_SetString(PyExc_ValueError,
`
771
771
`"strftime() requires year in [1; 9999]");
`
`@@ -1001,18 +1001,21 @@ time_mktime(PyObject *self, PyObject *tm_tuple)
`
1001
1001
`return NULL;
`
1002
1002
` }
`
1003
1003
``
1004
``
`-
#ifdef _AIX
`
``
1004
`+
#if defined(_AIX) || (defined(VXWORKS) && !defined(_WRS_CONFIG_LP64))
`
1005
1005
`/* bpo-19748: AIX mktime() valid range is 00:00:00 UTC, January 1, 1970
`
1006
1006
` to 03:14:07 UTC, January 19, 2038. Thanks to the workaround below,
`
1007
1007
` it is possible to support years in range [1902; 2037] */
`
1008
1008
`if (tm.tm_year < 2 || tm.tm_year > 137) {
`
1009
1009
`/* bpo-19748: On AIX, mktime() does not report overflow error
`
1010
``
`-
for timestamp < -2^31 or timestamp > 2**31-1. */
`
``
1010
`+
for timestamp < -2^31 or timestamp > 2**31-1. VxWorks has the
`
``
1011
`+
same issue when working in 32 bit mode. */
`
1011
1012
`PyErr_SetString(PyExc_OverflowError,
`
1012
1013
`"mktime argument out of range");
`
1013
1014
`return NULL;
`
1014
1015
` }
`
``
1016
`+
#endif
`
1015
1017
``
``
1018
`+
#ifdef _AIX
`
1016
1019
`/* bpo-34373: AIX mktime() has an integer overflow for years in range
`
1017
1020
` [1902; 1969]. Workaround the issue by using a year greater or equal than
`
1018
1021
` 1970 (tm_year >= 70): mktime() behaves correctly in that case
`