Unix and gmtime()
James Brister
brister at decwrl.dec.com
Sat Dec 22 02:53:56 AEST 1990
On 19 Dec 90 19:46:20 GMT, ghenniga at nmsu.edu (Gary Hennigan) said:
> If anyone's ever used either of these functions on a UNIX
> machine, or if you have any ideas as to what I'm doing wrong I would
> greatly appreciate the assistance.
The gmtime function according to the FM requires a parameter--the time in a
long inteter. Here's a "correct" version
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
main()
{
struct tm *clock;
int i1=1, i2;
long t ;
char *tod;
time (&t) ;
clock = gmtime(&t);
tod = asctime( clock );
printf("%s\n", tod );
return 1;
}
James
--
James Brister brister at decwrl.dec.com
DEC Western Software Lab., Palo Alto, CA {uunet,sun,pyramid}!decwrl!brister
More information about the Comp.unix.programmer
mailing list