NAME
timegm, timelocal - inverses for gmtime and localtime
SYNOPSIS
##iinncclluuddee <
ttiimmeett ttiimmeellooccaall ((ssttrruucctt ttmm **tm));; ttiimmeett ttiimmeeggmm ((ssttrruucctt ttmm **tm));;> DESCRIPTION
The functions ttiimmeellooccaall(()) and ttiimmeeggmm(()) are the inverses to llooccaallttiimmee(3) and ggmmttiimmee(3). NNOOTTEESSThese functions are GNU extensions. The ttiimmeellooccaall(()) function is equiv-
alent to the POSIX standard function mmkkttiimmee(3). There is no reason to ever use it. For a portable version of ttiimmeeggmm(()), set the TTZZ environment variable to UTC, call mmkkttiimmee(()) and restore the value of TTZZ. Something like#include
#include
timet mytimegm (struct tm *tm) {
timet ret; char *tz; tz = getenv("TZ"); setenv("TZ", "", 1); tzset(); ret = mktime(tm); if (tz) setenv("TZ", tz, 1); else unsetenv("TZ"); tzset(); return ret; }SEE ALSO
ggmmttiimmee(3), llooccaallttiimmee(3), mmkkttiimmee(3), ttzzsseett(3)GNU 2001-12-26 TIMEGM(3)