struct tm * gmtime ( const time_t * timer );
Convert time_t value to tm structure as UTC time.
Converts timer to tm structure adjusting to UTC (formerly known as GMT) timezone.
A pointer to a tm structure.
This structure is statically allocated and shared by gmtime, localtime and ctime functions. Each time one of these functions is called the content of the structure is overwritten.
Defined in ANSI-C.
/* gmtime example */
#define PST (-8)
#define CET (1)
#define HKG (8)
tm * ptm;
time ( &rawtime );
ptm = gmtime ( &rawtime );
printf ("Time in Los Angeles: %2d:%02d\n", ptm->tm_hour+PST, ptm->tm_min);
printf ("Time in Berlin: %2d:%02d\n", ptm->tm_hour+CET, ptm->tm_min);
printf ("Time in Hong Kong: %2d:%02d\n", ptm->tm_hour+HKG, ptm->tm_min);
Time in Los Angeles: 7:26
Time in Berlin: 16:26
Time in Hong Kong: 23:26
asctime, ctime, localtime, mktime, time