获取本地时间和格林威治时间一点用法

来源:互联网 发布:2k17樱木花道脸部数据 编辑:程序博客网 时间:2024/04/26 10:55
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>  
#include <stdlib.h>
#include <time.h>




void main()
{
struct tm*local;
time_t t;


t = time(NULL);
local = localtime(&t);
printf("local :%d\n",local->tm_hour);


local = gmtime(&t);
printf("UTC hour is:%d\n",local->tm_hour);


printf(asctime(local));


printf(ctime(&t));



}



0 0
原创粉丝点击