gmtime

Converts time units to broken-down UTC time.

Format

#include  <time.h>

struct tm *gmtime  (const time_t *timer);
Function Variants Compiling with the _DECC_V4_SOURCE and _VMS_V6_SOURCE feature- test macros defined enables a local-time-based entry point to this function that is equivalent to the behavior before OpenVMS Version 7.0.

Arguments

timer
Points to a variable that specifies a time value in seconds since the Epoch.

Description

This function converts the time (in seconds since the Epoch) pointed to by timer into a broken-down time, expressed as Coordinated Universal Time (UTC).

The tm structure is defined in the <time.h> header file as follows:
int tm_sec;  Seconds after the minute (0-60) 
int tm_min;  Minutes after the hour (0-59) 
int tm_hour;  Hours since midnight (0-23) 
int tm_mday;  Day of the month (1-31) 
int tm_mon;  Months since January (1-11) 
int tm_ year;  Years since 1900 
int tm_wday;  Days since Sunday (0-6) 
int tm_yday;  Days since January 1 (0- 365) 
int tm_isdst;  Daylight Savings Time flag

  • tm_isdst = 0 for Standard Time

  • tm_isdst = 1 for Daylight Time
 
long tm_gmtoff;[1]   Seconds east of Greenwich (Negative values indicate seconds west of Greenwich) 
char *tm_zone;[1]   Time zone string, for example "GMT" 

[1] This field is an extension to the ANSI C tm structure. It is present unless you compile your program with /STANDARD=ANSI89 or with _DECC_V4_SOURCE defined.


Note
Return values point to per- thread static storage, which is overwritten by subsequent calls to the gmtime function. You must make a copy if you wish to save it.

Return Values
Pointer to a tm structure. 
NULL  Indicates an error; errno is set to one of the following values:

  • EINVAL - The timer argument is NULL.
 


Previous Page | Next Page | Table of Contents | Index