函数名: gmtime
功 能: 把日期和时间转换为格林尼治标准时间(GMT)
用 法: #include <time.h>
struct tm *gmtime(long *clock);
程序例:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <dos.h>
/* Pacific Standard Time & Daylight Savings */
char *tzstr = "TZ=PST8PDT";
int main(void)
{
time_t t;
struct tm *gmt, *area;
putenv(tzstr);
tzset();
t = time(NULL);
area = localtime(&t);
printf("Local time is: %s", asctime(area));
gmt = gmtime(&t);
printf("GMT is: %s", asctime(gmt));
return 0;
}