Path: utzoo!attcan!telly!lethe!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!decuac!pa.dec.com!decwrl!brister From: brister@decwrl.dec.com (James Brister) Newsgroups: comp.unix.programmer Subject: Re: Unix and gmtime() Message-ID: Date: 21 Dec 90 15:53:56 GMT References: Sender: news@pa.dec.com (News) Followup-To: comp.unix.programmer Distribution: comp Organization: DEC Western Software Lab Lines: 34 In-Reply-To: ghenniga@nmsu.edu's message of 19 Dec 90 19:46:20 GMT X-Checksum-Snefru: b90cf2d0 563fb1d0 10898cc5 f764dc60 On 19 Dec 90 19:46:20 GMT, ghenniga@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 #include #include 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@decwrl.dec.com DEC Western Software Lab., Palo Alto, CA {uunet,sun,pyramid}!decwrl!brister