diff options
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index e8de0ac..6390c40 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -59,7 +59,7 @@ PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_FTIME #include <sys/timeb.h> -#ifndef MS_WINDOWS +#if !defined(MS_WINDOWS) && !defined(PYOS_OS2) extern int ftime(); #endif /* MS_WINDOWS */ #endif /* HAVE_FTIME */ @@ -85,6 +85,18 @@ extern int ftime(); #undef HAVE_CLOCK /* We have our own version down below */ #endif /* MS_WIN32 */ +#if defined(PYOS_OS2) +#define INCL_DOS +#define INCL_DOSERRORS +#define INCL_NOPMAPI +#include <os2.h> +#endif + +#if defined(PYCC_VACPP) +#include <time.h> +#define timezone _timezone +#endif + /* Forward declarations */ static int floatsleep Py_PROTO((double)); static double floattime Py_PROTO(()); @@ -588,10 +600,18 @@ floatsleep(double secs) Sleep((int)(secs*1000)); Py_END_ALLOW_THREADS #else /* !MS_WIN32 */ +#ifdef PYOS_OS2 + /* This Sleep *IS* Interruptable by Exceptions */ + if (DosSleep(secs * 1000) != NO_ERROR) { + PyErr_SetFromErrno(PyExc_IOError); + return -1; + } +#else /* !PYOS_OS2 */ /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS sleep((int)secs); Py_END_ALLOW_THREADS +#endif /* !PYOS_OS2 */ #endif /* !MS_WIN32 */ #endif /* !MSDOS */ #endif /* !__WATCOMC__ */ |