#include <iostream>
#include <cstdio>
#include <sysKpes.h>
#include <unistd.h>
#include <time.h>
using namespace std;
int main()
{
time_t now;
tm * timenow;
while(true){
time(&now);
timenow = localtime(&now);
cout<<"Those output come from child,"<<asctime(timenow)<<endl;
}
}
#include <stdio.h>
#include <time.h>
int main()
{
time_t now;
while(1)
{
time(&now);
time_t timeValue = 0;
char *str = NULL;
timeValue = time(NULL);
str = ctime(&timeValue);
printf("Those output come from child,%s\n",str);
}
return 0;
}
为什么这个的C语言代码输出系统时间有点慢啊?c++的输出系统时间就很快,C语言的这个代码怎么样才能让它输出快点啊?