/*--- 等待x毫秒 ---*/
int sleep(unsigned long x)
{
    clock_t c1 = clock(), c2;

    do {
        if ((c2 = clock()) == (clock_t)-1)    /* 错误 */
            return 0;
    } while (1000.0 * (c2 - c1) / CLOCKS_PER_SEC < x);
    return 1;
}

 

相关文章:

  • 2021-12-04
  • 2021-06-12
  • 2022-12-23
  • 2021-08-29
  • 2021-11-23
  • 2022-02-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2021-12-04
  • 2021-11-30
  • 2021-11-26
相关资源
相似解决方案