diff options
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 161407de45..8a81c8cf1e 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -37,16 +37,6 @@ #endif /* MS_WINDOWS */ #endif /* !__WATCOMC__ || __QNX__ */ -#if defined(PYOS_OS2) -#define INCL_DOS -#define INCL_ERRORS -#include <os2.h> -#endif - -#if defined(PYCC_VACPP) -#include <sys/time.h> -#endif - #if defined(__APPLE__) #include <mach/mach_time.h> #endif @@ -539,6 +529,26 @@ checktm(struct tm* buf) /* wcsftime() doesn't format correctly time zones, see issue #10653 */ # undef HAVE_WCSFTIME #endif +#define STRFTIME_FORMAT_CODES \ +"Commonly used format codes:\n\ +\n\ +%Y Year with century as a decimal number.\n\ +%m Month as a decimal number [01,12].\n\ +%d Day of the month as a decimal number [01,31].\n\ +%H Hour (24-hour clock) as a decimal number [00,23].\n\ +%M Minute as a decimal number [00,59].\n\ +%S Second as a decimal number [00,61].\n\ +%z Time zone offset from UTC.\n\ +%a Locale's abbreviated weekday name.\n\ +%A Locale's full weekday name.\n\ +%b Locale's abbreviated month name.\n\ +%B Locale's full month name.\n\ +%c Locale's appropriate date and time representation.\n\ +%I Hour (12-hour clock) as a decimal number [01,12].\n\ +%p Locale's equivalent of either AM or PM.\n\ +\n\ +Other codes may be available on your platform. See documentation for\n\ +the C library strftime function.\n" #ifdef HAVE_STRFTIME #ifdef HAVE_WCSFTIME @@ -683,13 +693,13 @@ time_strftime(PyObject *self, PyObject *args) #undef time_char #undef format_time - PyDoc_STRVAR(strftime_doc, "strftime(format[, tuple]) -> string\n\ \n\ Convert a time tuple to a string according to a format specification.\n\ See the library reference manual for formatting codes. When the time tuple\n\ -is not present, current time as returned by localtime() is used."); +is not present, current time as returned by localtime() is used.\n\ +\n" STRFTIME_FORMAT_CODES); #endif /* HAVE_STRFTIME */ static PyObject * @@ -712,7 +722,9 @@ PyDoc_STRVAR(strptime_doc, "strptime(string, format) -> struct_time\n\ \n\ Parse a string to a time tuple according to a format specification.\n\ -See the library reference manual for formatting codes (same as strftime())."); +See the library reference manual for formatting codes (same as\n\ +strftime()).\n\ +\n" STRFTIME_FORMAT_CODES); static PyObject * _asctime(struct tm *timeptr) @@ -1262,19 +1274,11 @@ PyInit_timezone(PyObject *m) { #if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) PyObject *otz0, *otz1; tzset(); -#ifdef PYOS_OS2 - PyModule_AddIntConstant(m, "timezone", _timezone); -#else /* !PYOS_OS2 */ PyModule_AddIntConstant(m, "timezone", timezone); -#endif /* PYOS_OS2 */ #ifdef HAVE_ALTZONE PyModule_AddIntConstant(m, "altzone", altzone); #else -#ifdef PYOS_OS2 - PyModule_AddIntConstant(m, "altzone", _timezone-3600); -#else /* !PYOS_OS2 */ PyModule_AddIntConstant(m, "altzone", timezone-3600); -#endif /* PYOS_OS2 */ #endif PyModule_AddIntConstant(m, "daylight", daylight); otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape"); @@ -1580,15 +1584,6 @@ floatsleep(double secs) } Py_END_ALLOW_THREADS } -#elif defined(PYOS_OS2) - /* This Sleep *IS* Interruptable by Exceptions */ - Py_BEGIN_ALLOW_THREADS - if (DosSleep(secs * 1000) != NO_ERROR) { - Py_BLOCK_THREADS - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - Py_END_ALLOW_THREADS #else /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS |