/*--- 等待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; }
此博客为转载内容,原链接为https://www.cnblogs.com/sea-stream/p/11037599.html ,标签涉及C/C++和操作系统。
/*--- 等待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; }
转载于:https://www.cnblogs.com/sea-stream/p/11037599.html
281

被折叠的 条评论
为什么被折叠?