fix and test

This commit is contained in:
Paul Sajna
2018-03-09 05:18:21 -08:00
parent e99857d125
commit 4d4ab1a75f
6 changed files with 31 additions and 2 deletions
+4
View File
@@ -0,0 +1,4 @@
typedef struct {
time_t tv_sec;
long tv_nsec;
} timespec;
+8
View File
@@ -24,4 +24,12 @@ typedef long time_t;
typedef int useconds_t;
typedef long suseconds_t;
typedef long clock_t;
typedef int clockid_t;
typedef void* timer_t;
#endif /* _SYS_TYPES_H */
+1 -1
View File
@@ -1,4 +1,4 @@
sys_includes = ["sys/types.h"]
sys_includes = ["sys/types.h", "bits/timespec.h", "stdint.h"]
include_guard = "_TIME_H"
language = "C"
+3
View File
@@ -20,7 +20,10 @@
/link
/link.out
/math
/setid
/sleep
/pipe
/printf
/rmdir
/unlink
/write
+2 -1
View File
@@ -19,6 +19,7 @@ BINS=\
rmdir \
pipe \
printf \
sleep \
write
all: $(BINS)
@@ -28,7 +29,7 @@ clean:
run: $(BINS)
for bin in $(BINS); \
do
do \
echo "# $${bin} #"; \
"./$${bin}" test args; \
done
+13
View File
@@ -0,0 +1,13 @@
#include <time.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char** argv) {
sleep(2);
perror("sleep");
usleep(1000);
perror("usleep");
timespec tm = {0, 10000};
nanosleep(&tm, NULL);
perror("nanosleep");
}