Use usleep() instead of sleep(), MinGW complained.

This commit is contained in:
Guus Sliepen 2011-07-23 14:11:44 +02:00
parent 50fcfea127
commit e16ead8dd9
3 changed files with 3 additions and 3 deletions

View file

@ -165,7 +165,7 @@ int gettimeofday(struct timeval *tv, void *tz) {
#endif #endif
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP
int usleep(long usec) { int usleep(long long usec) {
struct timeval tv = {usec / 1000000, (usec / 1000) % 1000}; struct timeval tv = {usec / 1000000, (usec / 1000) % 1000};
select(0, NULL, NULL, NULL, &tv); select(0, NULL, NULL, NULL, &tv);
return 0; return 0;

View file

@ -42,7 +42,7 @@ extern int gettimeofday(struct timeval *, void *);
#endif #endif
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP
extern int usleep(long); extern int usleep(long long);
#endif #endif
#endif /* __DROPIN_H__ */ #endif /* __DROPIN_H__ */

View file

@ -472,7 +472,7 @@ int main_loop(void) {
if(contradicting_del_edge > 100 && contradicting_add_edge > 100) { if(contradicting_del_edge > 100 && contradicting_add_edge > 100) {
logger(LOG_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", sleeptime); logger(LOG_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", sleeptime);
sleep(sleeptime); usleep(sleeptime * 1000000LL);
sleeptime *= 2; sleeptime *= 2;
if(sleeptime < 0) if(sleeptime < 0)
sleeptime = 3600; sleeptime = 3600;