Mercurial > mxe-octave
comparison src/build-msvctools/compat/usleep.c @ 3061:f8299bb6c872
Initial support for native MSVC compilation.
* add MSVC support files: compiler wrappers and support libraries
* adapt libiconv to work with MSVC
* adapt gettext to work with MSVC
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 17 Jun 2013 22:43:11 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3060:cbdf4575016d | 3061:f8299bb6c872 |
---|---|
1 /* | |
2 * usleep | |
3 * Implementation according to: | |
4 * The Open Group Base Specifications Issue 6 | |
5 * IEEE Std 1003.1, 2004 Edition | |
6 */ | |
7 | |
8 /* | |
9 * THIS SOFTWARE IS NOT COPYRIGHTED | |
10 * | |
11 * This source code is offered for use in the public domain. You may | |
12 * use, modify or distribute it freely. | |
13 * | |
14 * This code is distributed in the hope that it will be useful but | |
15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY | |
16 * DISCLAIMED. This includes but is not limited to warranties of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
18 * | |
19 * Contributed by: | |
20 * Ramiro Polla <ramiro@lisha.ufsc.br> | |
21 */ | |
22 | |
23 #include <sys/types.h> | |
24 #include <errno.h> | |
25 | |
26 #define WIN32_LEAN_AND_MEAN | |
27 #include <windows.h> | |
28 | |
29 int __cdecl usleep(useconds_t useconds) | |
30 { | |
31 if(useconds == 0) | |
32 return 0; | |
33 | |
34 if(useconds >= 1000000) | |
35 return EINVAL; | |
36 | |
37 Sleep((useconds + 999) / 1000); | |
38 | |
39 return 0; | |
40 } |