[Info-vax] no timegm() funtion in C RTL ?
John Reagan
johnrreagan at earthlink.net
Thu May 19 12:38:16 EDT 2011
"Pierre" <pierre.bru at gmail.com> wrote in message
news:338fe7d5-a78b-43a9-a56f-7c69c473053b at j23g2000yqc.googlegroups.com...
> hi
>
> I'm looking for the timegm() function in the C RTL but can not find
> it :-/
> http://www.codecogs.com/reference/c/time.h/ctime.php
>
> is this function standard and missing in DECC or is it an exotic
> function non standard function ?
>
> did the test on these config with the same result
> - alpha VMS 7.3-2, Compaq C V6.5-001-48BCD
> - itanium VMS 8.4, HP C V7.3-019-50H5P
>
> TIA,
> Pierre.
>
Here's part of the output from 'man timegm' on one of my Linux boxes
CONFORMING TO
These functions are non-standard GNU extensions that are also
present
on the BSDs. Avoid their use; see NOTES.
NOTES
The timelocal() function is equivalent to the POSIX standard
function
mktime(3). There is no reason to ever use it.
For a portable version of timegm(), set the TZ environment variable
to
UTC, call mktime(3) and restore the value of TZ. Something like
#include <time.h>
#include <stdlib.h>
time_t
my_timegm(struct tm *tm)
{
time_t 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;
}
More information about the Info-vax
mailing list