fork download
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. void sleep( unsigned long waitms )
  5. {
  6. clock_t goal;
  7. goal = (double)CLOCKS_PER_SEC*waitms/1000. + clock();
  8. while( goal > clock() ) ;
  9. }
  10.  
  11. int main()
  12. {
  13. clock_t start;
  14.  
  15. start = clock();
  16. sleep( 1234 );
  17. printf( "%f seconds\n", (double)(clock() - start) / CLOCKS_PER_SEC );
  18.  
  19. return 0;
  20. }
  21.  
  22.  
  23.  
Success #stdin #stdout 1.23s 2112KB
stdin
Standard input is empty
stdout
1.234002 seconds