关于计时器 有一处不懂 请帮忙
#include <stdio.h> #include <string.h>
#include <time.h>
#include <stdlib.h>
#include<iostream>
using namespace std;
int Show(void)
{
char str[100];
time_t t;
struct tm *lt;
t = time(0);
lt = localtime(&t);
strftime(str,100,"%Y-%m-%d %H:%M:%S ",lt);
cout<<"前日期及时间是:"<<str;
return 0;
}
void sleep( clock_t wait )// 问题:::请详细解释这个函数的三段语句的作用
{
clock_t goal;
goal = wait + clock();
while( goal > clock() ) ;
}
int main()
{
while(1)
{
system("cls");
Show();
sleep(1000);
}
system("pause");
return 0;
}