long StartTime=time(NULL);//记录开始时间//计算当前时间和开始时间之差,如果小于一定的阈值,则进入循环 while (time(NULL)-StartTime<**) { Sleep(1000); //停留一秒 *****; //在循环中做点别的事,天知道是什么事 ,^_^ }
time(NULL) 好像只能取到秒,不能到毫秒?double StartTime=time(NULL); while (time(NULL)-StartTime<**) //我想要判断条件为10毫秒,不知怎么做? { Sleep(1000); *****; }
Example The following example demonstrates how to handle timer wrap around.DWORD dwStart = GetTickCount();// Stop if this has taken too long if( GetTickCount() - dwStart >= TIMELIMIT ) Cancel();——摘自MSDN
while (time(NULL)-StartTime<**)
{
Sleep(1000); //停留一秒
*****; //在循环中做点别的事,天知道是什么事 ,^_^
}
while (time(NULL)-StartTime<**) //我想要判断条件为10毫秒,不知怎么做?
{
Sleep(1000);
*****;
}
The following example demonstrates how to handle timer wrap around.DWORD dwStart = GetTickCount();// Stop if this has taken too long
if( GetTickCount() - dwStart >= TIMELIMIT )
Cancel();——摘自MSDN