作者在 2016-05-29 18:21:08 发布以下内容
/***************************************************************
File name:time.c
Describe:get current time
Athor:
*****************************************************************/
#include<time.h>
#include<stdio.h>
#include<unistd.h>
int main(void)
{
while(1)
{
time_t t = time(NULL);
struct tm *p = NULL;
char str[200];
p = localtime(&t);
printf("\033[?25l");
strftime(str,200,"%T",p);
printf("%d-%d-%d\t%s\r",p->tm_year+1900,
p->tm_mon+1,p->tm_mday,str);
printf("\033[?25h");
fflush(stdout);
sleep(1);
}
return 0;
}
File name:time.c
Describe:get current time
Athor:
*****************************************************************/
#include<time.h>
#include<stdio.h>
#include<unistd.h>
int main(void)
{
while(1)
{
time_t t = time(NULL);
struct tm *p = NULL;
char str[200];
p = localtime(&t);
printf("\033[?25l");
strftime(str,200,"%T",p);
printf("%d-%d-%d\t%s\r",p->tm_year+1900,
p->tm_mon+1,p->tm_mday,str);
printf("\033[?25h");
fflush(stdout);
sleep(1);
}
return 0;
}