09a0194950b515cb85d3bf76b8defc0e1dc25a76
[oweals/cde.git] / cde / programs / dtscreen / usleep.c
1 /* $TOG: usleep.c /main/6 1998/04/06 13:32:38 mgreess $ */
2 /*
3  */
4 /*                                                                      *
5  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
6  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
7  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
8  * (c) Copyright 1993, 1994 Novell, Inc.                                *
9  */
10 /*-
11  * usleep.c - OS dependant implementation of usleep().
12  *
13  * Copyright (c) 1991 by Patrick J. Naughton.
14  *
15  * Revision History:
16  * 30-Aug-90: written.
17  *
18  */
19
20 #include "dtscreen.h"
21
22 #if !defined(_AIX) && !defined(hpV4) && !defined(linux)
23 int
24 usleep(unsigned long usec)
25 {
26 #ifdef SYSV
27     poll((struct poll *) 0, (size_t) 0, usec / 1000);   /* ms resolution */
28 #else
29     struct timeval timeout;
30     timeout.tv_usec = usec % (unsigned long) 1000000;
31     timeout.tv_sec = usec / (unsigned long) 1000000;
32     select(0, (void *) 0, (void *) 0, (void *) 0, &timeout);
33 #endif
34     return 0;
35 }
36 #endif /* !_AIX && !hpV4*/
37
38 /*
39  * returns the number of seconds since 01-Jan-70.
40  * This is used to control rate and timeout in many of the animations.
41  */
42 long
43 seconds()
44 {
45     struct timeval now;
46
47     gettimeofday(&now, (struct timezone *) 0);
48     return now.tv_sec;
49 }