[Previous] [Contents] [Next]

gmtime()

Convert calendar time to a broken-down time

Synopsis:

#include <time.h>

struct tm* gmtime( const time_t* timer );

Library:

libc

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 is reused each time gmtime() is called. If you want a thread-safe version of gmtime(), try gmtime_r().

The date command sets the computer's internal clock using Coordinated Universal Time (UTC). Use the TZ environment variable to establish the local time zone. See the section "The TZ environment variable" in the Global Data and the TZ Environment Variable chapter for a discussion of how to set the time zone.

Returns:

A pointer to a structure containing the broken-down time.

Classification:

ANSI, POSIX 1003.1

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

See also:

asctime(), asctime_r(), clock(), ctime(), difftime(), gmtime_r(), localtime(), localtime_r(), mktime(), strftime(), time(), tm, tzset()


[Previous] [Contents] [Next]