管理员
![Rank: 64](template/yeei_dream1/css/yeei//star_level3.gif) ![Rank: 64](template/yeei_dream1/css/yeei//star_level3.gif) ![Rank: 64](template/yeei_dream1/css/yeei//star_level3.gif) ![Rank: 64](template/yeei_dream1/css/yeei//star_level3.gif)
论坛积分
分
威望 点
贡献值 个
金币 枚
|
- int XSleep(int s)
2 n+ t% W. i( E5 }5 x. z - {
& P5 `& a c, d - time_t start_time, cur_time;//声明变量4 X! u0 Z5 Q2 N* y" \3 a& f
- time(&start_time);
, i: d/ s/ F3 `8 ?% `: |4 { - do {8 e, ^: I9 `6 [1 h6 b8 s8 e0 n' o( c
- time(&cur_time);1 \- c' I/ j8 R
- " S+ U4 {8 U" [' u: o4 \
- } while ((cur_time - start_time) < s);& u, H* t& O1 Z: ~ Q9 w" O( d$ Y
- {
3 S2 A, T2 c9 {, g
" R% S* ?, D- I) _5 f$ k- }8 _) E5 x; I: J- S, n
- ; D) K7 [3 V3 W% ^% n* P
- return (cur_time - start_time);" S$ K$ | \: C- h2 \
- }
复制代码
: H7 \1 C- w# q2 I
# c8 e) i# C o( M( o
/ ^$ Y) q' D5 w; f* }: z//调用方法
2 W) A3 w# m+ ]! F8 J% Q5 Z- if (XSleep(3)==3)
! p% F' |; P. @- |) \- U ^0 m - {- ?$ N( K2 L! W; l
- AfxMessageBox(_T("延迟正确"));
) i+ y+ U% a) j% y3 E1 Z, `0 g - }4 J* e f% }3 |2 w$ a0 J
- else {) K" l: p E- c; n8 h1 c+ ^
-
# ^' y" @% s; t; c. D: w+ g* g - AfxMessageBox(_T("延迟不正确"));
) {0 s3 u7 i/ h3 w+ [ - }
复制代码 , x1 D5 M/ k/ v) ]
$ |3 ^/ x, N4 m% ]" P
|
|