aboutsummaryrefslogtreecommitdiff
path: root/tests/unistd/sleep.c
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-23 05:49:48 +0300
committermax99x <max99x@gmail.com>2011-07-23 05:49:48 +0300
commit136756f734ecf14a28736900075d561e981e973e (patch)
treecf33472ea6550c6486ec7722facf34d98a16a51d /tests/unistd/sleep.c
parent586d229ec311daa5e89781eb6da822989e677789 (diff)
Added unistd tests; fixed a lot of unistd bugs and deficiencies.
Diffstat (limited to 'tests/unistd/sleep.c')
-rw-r--r--tests/unistd/sleep.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unistd/sleep.c b/tests/unistd/sleep.c
new file mode 100644
index 00000000..5a0302e2
--- /dev/null
+++ b/tests/unistd/sleep.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <time.h>
+
+int main() {
+ time_t start;
+
+ start = time(0);
+ printf("sleep(2) ret: %d\n", sleep(2));
+ printf("after sleep(2): %d\n", time(0) - start);
+ printf("errno: %d\n", errno);
+ errno = 0;
+
+ start = time(0);
+ printf("usleep(3000000) ret: %d\n", usleep(3100000));
+ printf("after usleep(3000000): %d\n", time(0) - start);
+ printf("errno: %d\n", errno);
+
+ return 0;
+}