Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 11, 2011
2 parents 14b0724 + 1771f61 commit 421c8b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

CFLAGS = -std=c99 -Wall -pedantic
CFLAGS = -std=c99 -D_POSIX_C_SOURCE=199309L -Wall -pedantic
PREFIX = /usr/local

watch: src/watch.c
Expand All @@ -14,4 +14,4 @@ uninstall:
clean:
rm -f watch

.PHONY: clean install uninstall
.PHONY: clean install uninstall
8 changes: 7 additions & 1 deletion src/watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <sys/wait.h>

Expand Down Expand Up @@ -73,7 +74,12 @@ milliseconds(const char *str) {

void
mssleep(int ms) {
usleep(ms * 1000);
struct timespec req = {0};
time_t sec = (int)(ms / 1000);
ms = ms -(sec * 1000);
req.tv_sec = sec;
req.tv_nsec = ms * 1000000L;
while(-1 == nanosleep(&req, &req)) ;
}

/*
Expand Down

0 comments on commit 421c8b2

Please sign in to comment.