1 #include "../include/sane/config.h" 2 3 #ifndef HAVE_SLEEP 4 5 #ifdef HAVE_WINDOWS_H 6 #include <windows.h> 7 #endif 8 sleep(unsigned int seconds)9unsigned int sleep(unsigned int seconds) 10 { 11 #ifdef HAVE_WINDOWS_H 12 Sleep(seconds*1000); 13 return 0; 14 #else 15 int rc = 0; 16 17 /* WARNING: Not all platforms support usleep() for more than 1 18 * second. Assuming if they do not have POSIX sleep then they 19 * do not have POSIX usleep() either and are using our internal 20 * version which can support it. If it fails, need to add an OS 21 * specific replacement like Sleep for Windows. 22 */ 23 if (usleep(seconds*1000000)) 24 rc = 1; 25 return rc; 26 #endif 27 28 } 29 30 #endif 31