时间编程--获取格林威治时间 gmtime

#include 
#include 

/**********************
*name:gmtime.c
*author:QG
*time:2015-05-12
*description:
**********************/


int main()
{
    time_t c_time;
    struct tm *c_tm;
    c_time = time(NULL);

    c_tm = gmtime(&c_time);

    printf("second: %d \n",c_tm->tm_sec);
    printf("min: %d \n",c_tm->tm_min);
    printf("hour: %d ,min: %d ,second: %d\n",c_tm->tm_hour,c_tm->tm_min,c_tm->tm_sec);
    printf("mday: %d \n",c_tm->tm_mday);
    printf("mon: %d \n",c_tm->tm_mon);
    printf("year: %d \n",c_tm->tm_year);
    printf("wday: %d \n",c_tm->tm_wday);
    printf("yday: %d \n",c_tm->tm_yday);
    printf("isdst: %d \n",c_tm->tm_isdst);

    return 0;
}

你可能感兴趣的:(LINUX)