Format
#include <time.h> struct tm *gmtime(const time_t *time);
Language Level: ANSI
Threadsafe: No. Use gmtime_r() instead.
Description
The gmtime() function breaks down the time value, in seconds, and stores it in a tm structure, defined in <time.h>. The value time is usually obtained by a call to the time() function.
The fields of the tm structure include:
Return Value
The gmtime() function returns a pointer to the resulting tm structure.
Notes:
Example that uses gmtime()
This example uses the gmtime() function to adjust a time_t representation to a Coordinated Universal Time character string, and then converts it to a printable string using the asctime() function.
#include <stdio.h> #include <time.h> int main(void) { time_t ltime; time(<ime); printf ("Coordinated Universal Time is %s\n", asctime(gmtime(<ime))); } /************************ Output should be similar to: ********** Coordinated Universal Time is Wed Aug 18 21:01:44 1993 */
Related Information
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.