![]() Chapter Contents |
![]() Previous |
![]() Next |
| gmtime |
| Portability: | ISO/ANSI C conforming, UNIX compatible, POSIX.1 conforming |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTIONS | |
| DIAGNOSTICS | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include <time.h> struct tm *gmtime(const time_t *timep);
| DESCRIPTION |
gmtime
converts a
time_t
value to Greenwich Mean
Time (GMT), separates it into components and returns a pointer to a
struct tm
containing the results.
| RETURN VALUE |
gmtime
returns a pointer to the broken-down GMT value. The pointer may be to
static
data, which may remain valid only until
the next call to
gmtime
,
localtime
, or
ctime
.
| CAUTIONS |
The pointer returned by
gmtime
may reference
static
storage,
which may be overwritten by the next call to
gmtime
,
localtime
, or
ctime
.
gmtime
assumes that
the value stored in the hardware time-of-day clock is GMT, as specified by
370 standards. If your site uses the time-of-day clock for local time, then
gmtime
returns local time, not Greenwich time,
and Greenwich time is unavailable.
| DIAGNOSTICS |
NULL
is returned if GMT is not available or if the argument value is not a valid
time.
| EXAMPLE |
#include <time.h>
#include <stdio.h>
main ()
{
time_t timeval;
struct tm *now;
time(&timeval);
now = gmtime(&timeval); /* Get current GMT time. */
if (now->tm_mon == 11 && now->tm_mday == 25)
puts("Merry Christmas.");
}
| RELATED FUNCTIONS |
| SEE ALSO |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.