[PATCH 11/19] rtcwake: 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/rtcwake.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index a1fd6dc..08f1c11 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -38,7 +38,6 @@
 #include "nls.h"
 #include "xalloc.h"
 #include "pathnames.h"
-#include "usleep.h"
 #include "strutils.h"
 #include "c.h"
 #include "closestream.h"
@@ -390,6 +389,7 @@ int main(int argc, char **argv)
 	int		t;
 	int		fd;
 	time_t		alarm = 0;
+	struct timespec	waittime;
 
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
@@ -550,7 +550,9 @@ int main(int argc, char **argv)
 				program_invocation_short_name, suspend, devname,
 				ctime(&alarm));
 		fflush(stdout);
-		usleep(10 * 1000);
+		waittime.tv_sec = 0;
+		waittime.tv_nsec = 10000000;
+		nanosleep(&waittime, NULL);
 	}
 
 	if (strcmp(suspend, "no") == 0) {
-- 
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