4.104.115
Last change
on this file since 3bacb250 was
1749cef,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/05/08 at 06:44:40
|
Compile contents conditionally.
|
-
Property mode set to
100644
|
File size:
886 bytes
|
Line | |
---|
1 | /* |
---|
2 | * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81 |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-2007. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #ifndef HAVE_USLEEP |
---|
19 | |
---|
20 | #include <time.h> |
---|
21 | #include <unistd.h> |
---|
22 | |
---|
23 | #include <rtems/system.h> |
---|
24 | #include <rtems/score/tod.h> |
---|
25 | |
---|
26 | |
---|
27 | int usleep( |
---|
28 | useconds_t useconds |
---|
29 | ) |
---|
30 | { |
---|
31 | struct timespec tp; |
---|
32 | struct timespec tm; |
---|
33 | unsigned remaining; |
---|
34 | |
---|
35 | tp.tv_sec = useconds / TOD_MICROSECONDS_PER_SECOND; |
---|
36 | tp.tv_nsec = (useconds % TOD_MICROSECONDS_PER_SECOND) * 1000; |
---|
37 | |
---|
38 | nanosleep( &tp, &tm ); |
---|
39 | |
---|
40 | remaining = tm.tv_sec * TOD_MICROSECONDS_PER_SECOND; |
---|
41 | remaining += tm.tv_nsec / 1000; |
---|
42 | return remaining; /* seconds remaining */ |
---|
43 | } |
---|
44 | |
---|
45 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.