home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / sredird / telnetcpcd-1.09.tar.gz / telnetcpcd-1.09.tar / msleep.c < prev    next >
C/C++ Source or Header  |  2003-08-12  |  463b  |  23 lines

  1. /*
  2.     msleep.c
  3.  
  4.     Copyright (c) 2002,2003 Thomas J Pinkl <tom@pinkl.com>
  5.  
  6.     implements usleep(3) using select(3).  the argument is the number 
  7.     of microseconds to sleep (1,000,000 microseconds == 1 second). 
  8.     returns 0 on success, -1 on error.
  9.  
  10.     Version 1.00    04/11/2000
  11. */
  12.  
  13. #include "telnetcpcd.h"
  14.  
  15. int msleep(unsigned long microsec)
  16. {
  17.     struct timeval tv;
  18.  
  19.     tv.tv_sec = microsec / 1000000L;
  20.     tv.tv_usec = microsec % 1000000L;
  21.     return(select(0,NULL,NULL,NULL,&tv));
  22. }
  23.