Path: utzoo!attcan!uunet!seismo!ukma!wuarchive!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!rpi!uupsi!njin!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul Falstad) Newsgroups: comp.lang.c Subject: Re: help to new C programmer with time.h Message-ID: <6750@idunno.Princeton.EDU> Date: 1 Mar 91 07:25:14 GMT References: <5284@vela.acs.oakland.edu> Sender: news@idunno.Princeton.EDU Organization: The Royal Society For Putting Things On Top Of Other Things Lines: 39 swood@vela.acs.oakland.edu ( EVENSONG) wrote: >main() >{ > struct tm tt; > time_t lt; > int d, m; > > time(<); > d = tt.tm_mday; > m = tt.tm_mon; > > printf("Day %d Month %d\n", d, m); >} Well, obviously the call to time isn't doing a thing to struct tm tt. You need to explicitly set it. struct tm tt; time_t lt; time(<); tt = *localtime(<); d = ... Or (better) struct tm *tt; time_t lt; time(<); tt = localtime(<); d = tt->tm_mday; m = tt->tm_mon; -- Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD "So how DO you delete a file called - ?" For viewers at home, the answer is coming up on your screen. For those of you who wish to play it the hard way, stand upside down with your head in a bucket of piranha fish.