C Reference function gmtime()

Usage of gmtime():

struct tm * gmtime ( const time_t * ptr_time);


The pointer ptr_time is a pointer to a time_t object that contains a calendar time.
Calendar time is the number of seconds that have elapsed since EPOCH, which is 00:00:00, January 1, 1970 Universal Coordinate Time (UTC)

Return Value:

The function gmtime() returns a pointer to a tm structure. The tm structure contains the time information.


The tm structure is statically allocated and shared by the functions gmtime and localtime.
If either one of these functions is called, then the content of the structure tm is overwritten.

Source code example of gmtime():

#include <stdio.h>
#include <time.h>

int main(void)
	time_t time_raw_format;
	printf ("Coordinated Universal Time is %s\n",
	return 0;

Output example of the program above:

	Coordinated Universal Time is Fri Jan 11 12:11:50 2008

This entry was posted in C Reference time.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.