blob: ed367471ab7dcafede829030b04cfeeb52a17f3a [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001/***********************************************************
Guido van Rossum524b5881995-01-04 19:10:35 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00004
5 All Rights Reserved
6
Guido van Rossumd266eb41996-10-25 14:44:06 +00007Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
Guido van Rossumf70e43a1991-02-19 12:39:46 +00009provided that the above copyright notice appear in all copies and that
Guido van Rossumd266eb41996-10-25 14:44:06 +000010both that copyright notice and this permission notice appear in
Guido van Rossumf70e43a1991-02-19 12:39:46 +000011supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000012Centrum or CWI or Corporation for National Research Initiatives or
13CNRI not be used in advertising or publicity pertaining to
14distribution of the software without specific, written prior
15permission.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000016
Guido van Rossumd266eb41996-10-25 14:44:06 +000017While CWI is the initial source for this software, a modified version
18is made available by the Corporation for National Research Initiatives
19(CNRI) at the Internet address ftp://ftp.python.org.
20
21STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28PERFORMANCE OF THIS SOFTWARE.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000029
30******************************************************************/
31
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000032/* Time module */
33
Guido van Rossum3f5da241990-12-20 15:06:42 +000034#include "allobjects.h"
Guido van Rossum3f5da241990-12-20 15:06:42 +000035#include "modsupport.h"
Guido van Rossumff4949e1992-08-05 19:58:53 +000036#include "ceval.h"
Guido van Rossum3f5da241990-12-20 15:06:42 +000037
Guido van Rossum99d90c01996-08-08 19:17:45 +000038#ifdef HAVE_SELECT
39#include "mymath.h"
40#endif
41
Guido van Rossum6d946f91992-08-14 13:49:30 +000042#ifdef macintosh
Guido van Rossumb6775db1994-08-01 11:34:53 +000043#include <time.h>
44#else
45#include <sys/types.h>
Guido van Rossum6d946f91992-08-14 13:49:30 +000046#endif
47
Guido van Rossumb6775db1994-08-01 11:34:53 +000048#ifdef QUICKWIN
49#include <io.h>
50#endif
51
52#ifdef HAVE_UNISTD_H
Guido van Rossum2762f251992-03-27 17:22:13 +000053#include <unistd.h>
54#endif
55
Guido van Rossumb6775db1994-08-01 11:34:53 +000056#ifdef HAVE_SELECT
57#include "myselect.h"
58#else
59#include "mytime.h"
60#endif
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000061
Guido van Rossumb6775db1994-08-01 11:34:53 +000062#ifdef HAVE_FTIME
63#include <sys/timeb.h>
Guido van Rossum1bb126f1996-12-06 20:17:44 +000064extern int ftime();
Guido van Rossumb6775db1994-08-01 11:34:53 +000065#endif
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000066
Guido van Rossumbceeac81996-05-23 22:53:47 +000067#ifdef __WATCOMC__
68#include <i86.h>
69#else
Guido van Rossumcac6c721996-09-06 13:34:02 +000070#ifdef MS_WINDOWS
Guido van Rossumb6775db1994-08-01 11:34:53 +000071#include <windows.h>
Guido van Rossumb2fb3641996-09-07 00:47:35 +000072#ifdef MS_WIN16
73/* These overrides not needed for Win32 */
Guido van Rossumb6775db1994-08-01 11:34:53 +000074#define timezone _timezone
Guido van Rossumcc081121995-03-14 15:05:41 +000075#define tzname _tzname
76#define daylight _daylight
77#define altzone _altzone
Guido van Rossumb2fb3641996-09-07 00:47:35 +000078#endif /* MS_WIN16 */
Guido van Rossumcac6c721996-09-06 13:34:02 +000079#endif /* MS_WINDOWS */
80#endif /* !__WATCOMC__ */
Guido van Rossum234f9421993-06-17 12:35:49 +000081
82/* Forward declarations */
Guido van Rossumb6775db1994-08-01 11:34:53 +000083static int floatsleep PROTO((double));
84static double floattime PROTO(());
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000085
86static object *
87time_time(self, args)
88 object *self;
89 object *args;
90{
Guido van Rossumb6775db1994-08-01 11:34:53 +000091 double secs;
Guido van Rossuma2b7f401993-01-04 09:09:59 +000092 if (!getnoarg(args))
93 return NULL;
Guido van Rossumb6775db1994-08-01 11:34:53 +000094 secs = floattime();
95 if (secs == 0.0) {
Guido van Rossuma2b7f401993-01-04 09:09:59 +000096 err_errno(IOError);
97 return NULL;
98 }
Guido van Rossumb6775db1994-08-01 11:34:53 +000099 return newfloatobject(secs);
100}
101
102#ifdef HAVE_CLOCK
103
104#ifndef CLOCKS_PER_SEC
Guido van Rossum1b66a4f1996-02-25 04:50:33 +0000105#ifdef CLK_TCK
106#define CLOCKS_PER_SEC CLK_TCK
107#else
Guido van Rossumb6775db1994-08-01 11:34:53 +0000108#define CLOCKS_PER_SEC 1000000
109#endif
Guido van Rossum1b66a4f1996-02-25 04:50:33 +0000110#endif
Guido van Rossumb6775db1994-08-01 11:34:53 +0000111
112static object *
113time_clock(self, args)
114 object *self;
115 object *args;
116{
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000117 if (!getnoarg(args))
118 return NULL;
Guido van Rossumb6775db1994-08-01 11:34:53 +0000119 return newfloatobject(((double)clock()) / CLOCKS_PER_SEC);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000120}
Guido van Rossumb6775db1994-08-01 11:34:53 +0000121#endif /* HAVE_CLOCK */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000122
123static object *
124time_sleep(self, args)
125 object *self;
126 object *args;
127{
Guido van Rossum775f4da1993-01-09 17:18:52 +0000128 double secs;
Guido van Rossum775f4da1993-01-09 17:18:52 +0000129 if (!getargs(args, "d", &secs))
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000130 return NULL;
Guido van Rossumff4949e1992-08-05 19:58:53 +0000131 BGN_SAVE
Guido van Rossumb6775db1994-08-01 11:34:53 +0000132 if (floatsleep(secs) != 0) {
Guido van Rossumff4949e1992-08-05 19:58:53 +0000133 RET_SAVE
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000134 return NULL;
135 }
Guido van Rossumff4949e1992-08-05 19:58:53 +0000136 END_SAVE
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000137 INCREF(None);
138 return None;
139}
140
Guido van Rossum234f9421993-06-17 12:35:49 +0000141static object *
142time_convert(when, function)
143 time_t when;
Guido van Rossumb6775db1994-08-01 11:34:53 +0000144 struct tm * (*function) PROTO((const time_t *));
Guido van Rossum234f9421993-06-17 12:35:49 +0000145{
Guido van Rossum6e8583d1996-10-08 14:19:52 +0000146 struct tm *p;
147 errno = 0;
148 p = function(&when);
149 if (p == NULL) {
150#ifdef EINVAL
Guido van Rossum0b1ff661996-11-02 17:31:22 +0000151 if (errno == 0)
Guido van Rossum6e8583d1996-10-08 14:19:52 +0000152 errno = EINVAL;
153#endif
154 return err_errno(IOError);
155 }
Guido van Rossum234f9421993-06-17 12:35:49 +0000156 return mkvalue("(iiiiiiiii)",
157 p->tm_year + 1900,
158 p->tm_mon + 1, /* Want January == 1 */
159 p->tm_mday,
160 p->tm_hour,
161 p->tm_min,
162 p->tm_sec,
163 (p->tm_wday + 6) % 7, /* Want Monday == 0 */
Guido van Rossum9e90a671993-06-24 11:10:19 +0000164 p->tm_yday + 1, /* Want January, 1 == 1 */
Guido van Rossum234f9421993-06-17 12:35:49 +0000165 p->tm_isdst);
166}
167
168static object *
169time_gmtime(self, args)
170 object *self;
171 object *args;
172{
173 double when;
174 if (!getargs(args, "d", &when))
175 return NULL;
176 return time_convert((time_t)when, gmtime);
177}
178
179static object *
180time_localtime(self, args)
181 object *self;
182 object *args;
183{
184 double when;
185 if (!getargs(args, "d", &when))
186 return NULL;
187 return time_convert((time_t)when, localtime);
188}
189
Guido van Rossum9e90a671993-06-24 11:10:19 +0000190static int
191gettmarg(args, p)
192 object *args;
193 struct tm *p;
194{
195 if (!getargs(args, "(iiiiiiiii)",
196 &p->tm_year,
197 &p->tm_mon,
198 &p->tm_mday,
199 &p->tm_hour,
200 &p->tm_min,
201 &p->tm_sec,
202 &p->tm_wday,
203 &p->tm_yday,
204 &p->tm_isdst))
205 return 0;
206 if (p->tm_year >= 1900)
207 p->tm_year -= 1900;
208 p->tm_mon--;
209 p->tm_wday = (p->tm_wday + 1) % 7;
210 p->tm_yday--;
211 return 1;
212}
213
Guido van Rossum8d8c1ee1995-09-13 17:38:35 +0000214#ifdef HAVE_STRFTIME
215static object *
216time_strftime(self, args)
217 object *self;
218 object *args;
219{
220 struct tm buf;
221 const char *fmt;
222 char *outbuf = 0;
223 int i;
224
225 if (!PyArg_ParseTuple(args, "s(iiiiiiiii)",
226 &fmt,
227 &(buf.tm_year),
228 &(buf.tm_mon),
229 &(buf.tm_mday),
230 &(buf.tm_hour),
231 &(buf.tm_min),
232 &(buf.tm_sec),
233 &(buf.tm_wday),
234 &(buf.tm_yday),
235 &(buf.tm_isdst)))
236 return NULL;
237 if (buf.tm_year >= 1900)
238 buf.tm_year -= 1900;
239 buf.tm_mon--;
240 buf.tm_wday = (buf.tm_wday + 1) % 7;
241 buf.tm_yday--;
242 /* I hate these functions that presume you know how big the output */
243 /* will be ahead of time... */
244 for (i = 1024 ; i < 8192 ; i += 1024) {
245 outbuf = malloc(i);
246 if (outbuf == NULL) {
247 return err_nomem();
248 }
249 if (strftime(outbuf, i-1, fmt, &buf) != 0) {
250 object *ret;
251 ret = newstringobject(outbuf);
252 free(outbuf);
253 return ret;
254 }
255 free(outbuf);
256 }
257 return err_nomem();
258}
259#endif /* HAVE_STRFTIME */
260
Guido van Rossum9e90a671993-06-24 11:10:19 +0000261static object *
262time_asctime(self, args)
263 object *self;
264 object *args;
265{
266 struct tm buf;
267 char *p;
268 if (!gettmarg(args, &buf))
269 return NULL;
270 p = asctime(&buf);
271 if (p[24] == '\n')
272 p[24] = '\0';
273 return newstringobject(p);
274}
275
276static object *
277time_ctime(self, args)
278 object *self;
279 object *args;
280{
281 double dt;
282 time_t tt;
283 char *p;
284 if (!getargs(args, "d", &dt))
285 return NULL;
Guido van Rossumcac6c721996-09-06 13:34:02 +0000286 tt = (time_t)dt;
Guido van Rossum9e90a671993-06-24 11:10:19 +0000287 p = ctime(&tt);
288 if (p[24] == '\n')
289 p[24] = '\0';
290 return newstringobject(p);
291}
292
Guido van Rossum234f9421993-06-17 12:35:49 +0000293static object *
294time_mktime(self, args)
295 object *self;
296 object *args;
297{
298 struct tm buf;
Guido van Rossumbceeac81996-05-23 22:53:47 +0000299 time_t tt;
300 tt = time(&tt);
301 buf = *localtime(&tt);
Guido van Rossum9e90a671993-06-24 11:10:19 +0000302 if (!gettmarg(args, &buf))
Guido van Rossum234f9421993-06-17 12:35:49 +0000303 return NULL;
Guido van Rossumbceeac81996-05-23 22:53:47 +0000304 tt = mktime(&buf);
305 if (tt == (time_t)(-1)) {
306 err_setstr(OverflowError, "mktime argument out of range");
307 return NULL;
308 }
309 return newfloatobject((double)tt);
Guido van Rossum234f9421993-06-17 12:35:49 +0000310}
311
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000312static struct methodlist time_methods[] = {
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000313 {"time", time_time},
Guido van Rossumb6775db1994-08-01 11:34:53 +0000314#ifdef HAVE_CLOCK
315 {"clock", time_clock},
316#endif
317 {"sleep", time_sleep},
Guido van Rossum234f9421993-06-17 12:35:49 +0000318 {"gmtime", time_gmtime},
319 {"localtime", time_localtime},
Guido van Rossum9e90a671993-06-24 11:10:19 +0000320 {"asctime", time_asctime},
321 {"ctime", time_ctime},
Guido van Rossum234f9421993-06-17 12:35:49 +0000322 {"mktime", time_mktime},
Guido van Rossum8d8c1ee1995-09-13 17:38:35 +0000323#ifdef HAVE_STRFTIME
Guido van Rossum5416e201996-02-13 00:14:09 +0000324 {"strftime", time_strftime, 1},
Guido van Rossum8d8c1ee1995-09-13 17:38:35 +0000325#endif
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000326 {NULL, NULL} /* sentinel */
327};
328
Guido van Rossum8239f0f1995-01-22 00:49:01 +0000329static void
330ins(d, name, v)
331 object *d;
332 char *name;
333 object *v;
334{
335 if (v == NULL)
336 fatal("Can't initialize time module -- NULL value");
337 if (dictinsert(d, name, v) != 0)
338 fatal("Can't initialize time module -- dictinsert failed");
339 DECREF(v);
340}
341
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000342void
343inittime()
344{
Jack Jansen8ccfc931995-10-03 14:39:44 +0000345 object *m, *d;
Guido van Rossum234f9421993-06-17 12:35:49 +0000346 m = initmodule("time", time_methods);
347 d = getmoduledict(m);
Guido van Rossumb6775db1994-08-01 11:34:53 +0000348#ifdef HAVE_TZNAME
Guido van Rossum234f9421993-06-17 12:35:49 +0000349 tzset();
Guido van Rossum8239f0f1995-01-22 00:49:01 +0000350 ins(d, "timezone", newintobject((long)timezone));
Guido van Rossumb6775db1994-08-01 11:34:53 +0000351#ifdef HAVE_ALTZONE
Guido van Rossum8239f0f1995-01-22 00:49:01 +0000352 ins(d, "altzone", newintobject((long)altzone));
Guido van Rossumb6775db1994-08-01 11:34:53 +0000353#else
Guido van Rossum8239f0f1995-01-22 00:49:01 +0000354 ins(d, "altzone", newintobject((long)timezone-3600));
Guido van Rossumb6775db1994-08-01 11:34:53 +0000355#endif
Guido van Rossum8239f0f1995-01-22 00:49:01 +0000356 ins(d, "daylight", newintobject((long)daylight));
357 ins(d, "tzname", mkvalue("(zz)", tzname[0], tzname[1]));
Guido van Rossumb6775db1994-08-01 11:34:53 +0000358#else /* !HAVE_TZNAME */
359#if HAVE_TM_ZONE
Guido van Rossum234f9421993-06-17 12:35:49 +0000360 {
361#define YEAR ((time_t)((365 * 24 + 6) * 3600))
362 time_t t;
363 struct tm *p;
364 long winterzone, summerzone;
365 char wintername[10], summername[10];
Guido van Rossumb6775db1994-08-01 11:34:53 +0000366 /* XXX This won't work on the southern hemisphere.
367 XXX Anybody got a better idea? */
Guido van Rossum234f9421993-06-17 12:35:49 +0000368 t = (time((time_t *)0) / YEAR) * YEAR;
369 p = localtime(&t);
370 winterzone = -p->tm_gmtoff;
371 strncpy(wintername, p->tm_zone ? p->tm_zone : " ", 9);
372 wintername[9] = '\0';
373 t += YEAR/2;
374 p = localtime(&t);
375 summerzone = -p->tm_gmtoff;
376 strncpy(summername, p->tm_zone ? p->tm_zone : " ", 9);
377 summername[9] = '\0';
Guido van Rossum8239f0f1995-01-22 00:49:01 +0000378 ins(d, "timezone", newintobject(winterzone));
379 ins(d, "altzone", newintobject(summerzone));
380 ins(d, "daylight", newintobject((long)(winterzone != summerzone)));
381 ins(d, "tzname", mkvalue("(zz)", wintername, summername));
Guido van Rossum234f9421993-06-17 12:35:49 +0000382 }
Guido van Rossumb6775db1994-08-01 11:34:53 +0000383#endif /* HAVE_TM_ZONE */
384#endif /* !HAVE_TZNAME */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000385}
386
387
Guido van Rossumb6775db1994-08-01 11:34:53 +0000388/* Implement floattime() for various platforms */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000389
Guido van Rossumb6775db1994-08-01 11:34:53 +0000390static double
391floattime()
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000392{
Guido van Rossumb6775db1994-08-01 11:34:53 +0000393 /* There are three ways to get the time:
394 (1) gettimeofday() -- resolution in microseconds
395 (2) ftime() -- resolution in milliseconds
396 (3) time() -- resolution in seconds
397 In all cases the return value is a float in seconds.
398 Since on some systems (e.g. SCO ODT 3.0) gettimeofday() may
399 fail, so we fall back on ftime() or time().
400 Note: clock resolution does not imply clock accuracy! */
401#ifdef HAVE_GETTIMEOFDAY
402 {
Guido van Rossum426035c1991-02-19 12:27:35 +0000403 struct timeval t;
Guido van Rossum3bbc62e1995-01-02 19:30:30 +0000404#ifdef GETTIMEOFDAY_NO_TZ
405 if (gettimeofday(&t) == 0)
406 return (double)t.tv_sec + t.tv_usec*0.000001;
407#else /* !GETTIMEOFDAY_NO_TZ */
Guido van Rossumb6775db1994-08-01 11:34:53 +0000408 if (gettimeofday(&t, (struct timezone *)NULL) == 0)
409 return (double)t.tv_sec + t.tv_usec*0.000001;
Guido van Rossum3bbc62e1995-01-02 19:30:30 +0000410#endif /* !GETTIMEOFDAY_NO_TZ */
Guido van Rossumb6775db1994-08-01 11:34:53 +0000411 }
412#endif /* !HAVE_GETTIMEOFDAY */
413 {
414#ifdef HAVE_FTIME
415 struct timeb t;
416 ftime(&t);
Guido van Rossum7b1e9741994-08-29 10:46:42 +0000417 return (double)t.time + (double)t.millitm * (double)0.001;
Guido van Rossumb6775db1994-08-01 11:34:53 +0000418#else /* !HAVE_FTIME */
419 time_t secs;
420 time(&secs);
421 return (double)secs;
422#endif /* !HAVE_FTIME */
423 }
Guido van Rossum426035c1991-02-19 12:27:35 +0000424}
425
Guido van Rossumb6775db1994-08-01 11:34:53 +0000426
427/* Implement floatsleep() for various platforms.
428 When interrupted (or when another error occurs), return -1 and
429 set an exception; else return 0. */
430
431static int
Guido van Rossuma320fd31995-03-09 12:14:15 +0000432#ifdef MPW
433floatsleep(double secs)
434#else
Guido van Rossum775f4da1993-01-09 17:18:52 +0000435floatsleep(secs)
436 double secs;
Guido van Rossuma320fd31995-03-09 12:14:15 +0000437#endif /* MPW */
Guido van Rossum426035c1991-02-19 12:27:35 +0000438{
Guido van Rossumb6775db1994-08-01 11:34:53 +0000439#ifdef HAVE_SELECT
Guido van Rossum426035c1991-02-19 12:27:35 +0000440 struct timeval t;
Guido van Rossum775f4da1993-01-09 17:18:52 +0000441 double frac;
Guido van Rossum775f4da1993-01-09 17:18:52 +0000442 frac = fmod(secs, 1.0);
443 secs = floor(secs);
444 t.tv_sec = (long)secs;
445 t.tv_usec = (long)(frac*1000000.0);
Guido van Rossumb6775db1994-08-01 11:34:53 +0000446 if (select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t) != 0) {
447 err_errno(IOError);
448 return -1;
449 }
450#else /* !HAVE_SELECT */
451#ifdef macintosh
452#define MacTicks (* (long *)0x16A)
453 long deadline;
454 deadline = MacTicks + (long)(secs * 60.0);
455 while (MacTicks < deadline) {
456 if (sigcheck())
457 return -1;
458 }
459#else /* !macintosh */
Guido van Rossumbceeac81996-05-23 22:53:47 +0000460#ifdef __WATCOMC__
461 /* XXX Can't interrupt this sleep */
462 delay((int)(secs * 1000 + 0.5)); /* delay() uses milliseconds */
463#else /* !__WATCOMC__ */
Guido van Rossume22e6441993-07-09 10:51:31 +0000464#ifdef MSDOS
Guido van Rossumb6775db1994-08-01 11:34:53 +0000465 struct timeb t1, t2;
466 double frac;
467 extern double fmod PROTO((double, double));
468 extern double floor PROTO((double));
469 if (secs <= 0.0)
470 return;
471 frac = fmod(secs, 1.0);
472 secs = floor(secs);
473 ftime(&t1);
474 t2.time = t1.time + (int)secs;
475 t2.millitm = t1.millitm + (int)(frac*1000.0);
476 while (t2.millitm >= 1000) {
477 t2.time++;
478 t2.millitm -= 1000;
479 }
480 for (;;) {
481#ifdef QUICKWIN
482 _wyield();
Guido van Rossum80c9d881991-04-16 08:47:51 +0000483#endif
Guido van Rossumb6775db1994-08-01 11:34:53 +0000484 if (sigcheck())
485 return -1;
486 ftime(&t1);
487 if (t1.time > t2.time ||
488 t1.time == t2.time && t1.millitm >= t2.millitm)
489 break;
490 }
491#else /* !MSDOS */
Guido van Rossumb2fb3641996-09-07 00:47:35 +0000492#ifdef MS_WIN32
Guido van Rossumb6775db1994-08-01 11:34:53 +0000493 /* XXX Can't interrupt this sleep */
494 Sleep((int)(secs*1000));
Guido van Rossumb2fb3641996-09-07 00:47:35 +0000495#else /* !MS_WIN32 */
Guido van Rossumb6775db1994-08-01 11:34:53 +0000496 /* XXX Can't interrupt this sleep */
497 sleep((int)secs);
Guido van Rossumb2fb3641996-09-07 00:47:35 +0000498#endif /* !MS_WIN32 */
Guido van Rossumb6775db1994-08-01 11:34:53 +0000499#endif /* !MSDOS */
Guido van Rossumbceeac81996-05-23 22:53:47 +0000500#endif /* !__WATCOMC__ */
Guido van Rossumb6775db1994-08-01 11:34:53 +0000501#endif /* !macintosh */
502#endif /* !HAVE_SELECT */
503 return 0;
Guido van Rossum80c9d881991-04-16 08:47:51 +0000504}