fix and test
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
typedef struct {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
} timespec;
|
||||
@@ -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,4 +1,4 @@
|
||||
sys_includes = ["sys/types.h"]
|
||||
sys_includes = ["sys/types.h", "bits/timespec.h", "stdint.h"]
|
||||
include_guard = "_TIME_H"
|
||||
language = "C"
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
/link
|
||||
/link.out
|
||||
/math
|
||||
/setid
|
||||
/sleep
|
||||
/pipe
|
||||
/printf
|
||||
/rmdir
|
||||
/unlink
|
||||
/write
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user