Path: utzoo!attcan!telly!lethe!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!fozzie!stanley From: stanley@phoenix.com (John Stanley) Newsgroups: comp.lang.c Subject: Re: Unix and gmtime() Message-ID: Date: 20 Dec 90 00:21:41 GMT References: Organization: One Man Brand Lines: 35 ghenniga@nmsu.edu (Gary Hennigan) writes: > I get is garbage. I know that my "tm" structure is being initialized > but it's being initialized to garbage, eg., I get a time of Dec. 31, > 2002 or some such upon returning from the asctime() function. Because you are passing garbage to gmtime(). > ---------------------------------------------------------------------- > #include > #include > #include > > main() > { > struct tm *clock; > int i1=1, i2; > char *tod; time_t mytime; time(&mytime); clock = gmtime( &mytime ); > tod = asctime( clock ); > > printf("%s\n", tod ); > > return 1; > } > ---------------------------------------------------------------------- I don't have access to the UNIX man pages for gmtime, but I can't believe they don't show a required parameter. Wouldn't it be nice if all compilers would use prototypes. My TC 2.0 refused to compile the original code, telling me that gmtime was missing required parameters.