码迷,mamicode.com
首页 > 系统相关 > 详细

Linux编程(获取系统时间)

时间:2014-07-26 16:57:52      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   linux   div   ar   时间   

#include <stdio.h>
#include <time.h>

int main()
{

        time_t  now;
        struct  tm  *w;
        time(&now);
        w=localtime(&now);
        printf("%04d/%02d/%02d\n%02d:%02d:%02d\n",w->tm_year+1900,
                w->tm_mon+1,w->tm_mday,w->tm_hour,w->tm_min,w->tm_sec);

        return 0;
}

 

Linux编程(获取系统时间),布布扣,bubuko.com

Linux编程(获取系统时间)

标签:style   blog   color   io   linux   div   ar   时间   

原文地址:http://www.cnblogs.com/verstin/p/3870197.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!