diff options
author | Guido van Rossum <guido@python.org> | 1997-11-22 21:53:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-22 21:53:48 (GMT) |
commit | 8e9ebfd337f18f7b707853a3f2f49cc6245c0596 (patch) | |
tree | fe6a0f373d376dede8ad635c250ab83c19965a3f /Modules/timemodule.c | |
parent | c0b93191e6e12fb391461545031808f74a8ae956 (diff) | |
download | cpython-8e9ebfd337f18f7b707853a3f2f49cc6245c0596.zip cpython-8e9ebfd337f18f7b707853a3f2f49cc6245c0596.tar.gz cpython-8e9ebfd337f18f7b707853a3f2f49cc6245c0596.tar.bz2 |
os2 patch by Jeff Rush
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__ */ |