gmtime()

Convert calendar time to a broken-down time

Synopsis:

#include <time.h>

struct tm* gmtime( const time_t* timer );

Arguments:

timer
A pointer to a time_t structure that contains the time that you want to convert.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The gmtime() function converts the calendar time pointed to by timer into a broken-down time, expressed as Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time or GMT).

The gmtime() function places the converted time in a static structure that's reused each time you call gmtime() or localtime() . Calling asctime() or ctime() could also change the data in this static buffer.

In a multithreaded application, use gmtime_r() .

You typically use the date command to set the computer's internal clock using Coordinated Universal Time (UTC). Use the TZ environment variable or _CS_TIMEZONE configuration string to establish the local time zone.

Returns:

A pointer to the static tm structure that contains the broken-down time.

Classification:

ANSI, POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread No

Last modified: 2013-12-23

comments powered by Disqus