Syntax
#include <time.h> struct tm *gmtime(const time_t *time);Description
The gmtime function breaks down the time value and stores it in a tm structure, defined in time.h. The structure pointed to by the return value reflects Coordinated Universal Time, not local time. The value time is usually obtained from a call to time.
The fields of the tm structure include: compact break=fit.
tm_sec
gmtime returns a pointer to the resulting tm structure. It returns NULL if Coordinated Universal Time is not available.
Note:
This example uses gmtime to adjust a time_t representation to a Coordinated Universal Time character string, and then converts it to a printable string using asctime.
#include <stdio.h>#include <time.h> int main(void) { time_t ltime; time(<ime); printf("Coordinated Universal Time is %s\n", asctime(gmtime(<ime))); return 0; /**************************************************************************** The output should be similar to: Coordinated Universal Time is Mon Sep 16 21:44 1995 ****************************************************************************/ }Related Information