Debian Codegraph @

libsrc/os/unix/ospuwait.c

raw
1 /*===========================================================================
2 Copyright (C) 1995-2009 European Southern Observatory (ESO)
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public
15 License along with this program; if not, write to the Free
16 Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
17 MA 02139, USA.
18
19 Correspondence concerning ESO-MIDAS should be addressed as follows:
20 Internet e-mail: [email protected]
21 Postal address: European Southern Observatory
22 Data Management Division
23 Karl-Schwarzschild-Strasse 2
24 D 85748 Garching bei Muenchen
25 GERMANY
26 ===========================================================================*/
27
28 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29 .TYPE Module
30 .NAME ospuwait
31 .LANGUAGE C
32 .AUTHOR IPG-ESO Garching
33 .CATEGORY Host operating system interfaces, Process control.
34 .COMMENTS ospuwait() has been stripped from it original osp.c file
35 because it can not be compiled with the POSIX_SOURCE definition
36 on HP-UX.
37 .VERSIONS
38
39 090324 last mdoif
40 -------------------------------------------------------------------------*/
41
42 #include <sys/types.h>
43 #include <sys/time.h>
44 #include <stdio.h>
45 #include <proto_os.h> /* ANSI-C prototyping */
46
47
48
49 int ospuwait(time)
50 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51 .PURPOSE Delays the execution of a process for a time interval.
52 Resolution of time interval is in microseconds.
53 .RETURNS Always 0
54 .REMARKS System dependencies:
55 -- UNIX: select(2)
56 ------------------------------------------------------------*/
57 unsigned int time; /* IN : time delay in microseconds */
58 {
59 struct timeval tval;
60
61 tval.tv_sec = time / 1000000;
62 tval.tv_usec = time % 1000000;
63 select(0,NULL,NULL,NULL, &tval);
64 return(0);
65 }