parent
0fed6b1c5d
commit
3daf0b8a81
1 changed files with 3 additions and 4 deletions
@ -1,21 +1,20 @@ |
||||
/* Simple prog that sleeps for a random time. */ |
||||
|
||||
#include<stdlib.h> |
||||
#if !defined(_MSC_VER) |
||||
#include<time.h> |
||||
#else |
||||
#if defined(_WIN32) |
||||
#include<windows.h> |
||||
#endif |
||||
|
||||
int main(int argc, char **argv) { |
||||
srand(time(NULL)); |
||||
#if !defined(_MSC_VER) |
||||
#if !defined(_WIN32) |
||||
struct timespec t; |
||||
t.tv_sec = 0; |
||||
t.tv_nsec = 199999999.0*rand()/RAND_MAX; |
||||
nanosleep(&t, NULL); |
||||
#else |
||||
Sleep(500.0*rand()/RAND_MAX); |
||||
Sleep(50.0*rand()/RAND_MAX); |
||||
#endif |
||||
return 0; |
||||
} |
||||
|
Loading…
Reference in new issue