usleep.c (30443) | usleep.c (30479) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; 36#endif /* LIBC_SCCS and not lint */ 37 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; 36#endif /* LIBC_SCCS and not lint */ 37 |
38#include <errno.h> 39#include <sys/time.h> 40#include <signal.h> | 38#include <time.h> |
41#include <unistd.h> 42 43void 44usleep(useconds) 45 unsigned int useconds; 46{ 47 struct timespec time_to_sleep; 48 49 if (useconds) { 50 time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; 51 time_to_sleep.tv_sec = useconds / 1000000; 52 (void)nanosleep(&time_to_sleep, NULL); 53 } 54} | 39#include <unistd.h> 40 41void 42usleep(useconds) 43 unsigned int useconds; 44{ 45 struct timespec time_to_sleep; 46 47 if (useconds) { 48 time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; 49 time_to_sleep.tv_sec = useconds / 1000000; 50 (void)nanosleep(&time_to_sleep, NULL); 51 } 52} |