[PATCH 10/19] hwclock: replace usleep with nanosleep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



POSIX.1-2001 declares usleep is obsolete.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html
Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 sys-utils/hwclock-kd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys-utils/hwclock-kd.c b/sys-utils/hwclock-kd.c
index bfe50dc..c000024 100644
--- a/sys-utils/hwclock-kd.c
+++ b/sys-utils/hwclock-kd.c
@@ -12,7 +12,6 @@
 # include <unistd.h>
 
 # include "nls.h"
-# include "usleep.h"
 
 /* Get defines for KDGHWCLK and KDSHWCLK (m68k) */
 # include <linux/kd.h>
@@ -68,7 +67,10 @@ static int synchronize_to_clock_tick_kd(void)
 		 *  A2000 RTCs and simply hangs after some time. Inserting a
 		 *  sleep helps."
 		 */
-		usleep(1);
+		struct timespec waittime;
+		waittime.tv_sec = 0;
+		waittime.tv_nsec = 1000;
+		nanosleep(&waittime, NULL);
 
 		if (ioctl(con_fd, KDGHWCLK, &nowtime) == -1) {
 			warn(_("KDGHWCLK ioctl to read time failed in loop"));
-- 
1.7.12.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux