动态时间--时钟

作者在 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;
}

默认分类 | 阅读 19977 次
文章评论,共0条
游客请输入验证码
浏览19973次
文章分类
文章归档
最新评论