diff --git a/headers/posix/unistd.h b/headers/posix/unistd.h index 2c3191d35d..585a8b61e5 100644 --- a/headers/posix/unistd.h +++ b/headers/posix/unistd.h @@ -129,7 +129,7 @@ extern int tcsetpgrp(int fd, pid_t pgrpid); extern void *sbrk(long incr); extern unsigned int alarm(unsigned int seconds); -extern useconds_t ualarm(unsigned int microSeconds, unsigned int interval); +extern useconds_t ualarm(useconds_t microSeconds, useconds_t interval); extern unsigned int sleep(unsigned int seconds); extern int usleep(unsigned int microSeconds); extern clock_t clock(void); diff --git a/src/system/libroot/posix/unistd/ualarm.c b/src/system/libroot/posix/unistd/ualarm.c index 6331323c28..927827ac6b 100644 --- a/src/system/libroot/posix/unistd/ualarm.c +++ b/src/system/libroot/posix/unistd/ualarm.c @@ -1,7 +1,7 @@ /* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include @@ -11,15 +11,15 @@ #include -uint -ualarm(uint usec, uint interval) +useconds_t +ualarm(useconds_t usec, useconds_t interval) { struct itimerval value, oldValue; - value.it_value.tv_sec = 0; - value.it_value.tv_usec = usec; - value.it_interval.tv_sec = 0; - value.it_interval.tv_usec = interval; + value.it_value.tv_sec = usec / 1000000; + value.it_value.tv_usec = usec % 1000000; + value.it_interval.tv_sec = interval / 1000000; + value.it_interval.tv_usec = interval % 1000000; if (setitimer(ITIMER_REAL, &value, &oldValue) < 0) return -1;