Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!decwrl!sun-barr!newstop!texsun!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.c Subject: Re: How to get the time... Message-ID: <1991Feb18.182148.16010@convex.com> Date: 18 Feb 91 18:21:48 GMT References: <5680@baird.cs.strath.ac.uk> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: comp.lang.c Organization: CONVEX Software Development, Richardson, TX Lines: 26 Nntp-Posting-Host: pixel.convex.com From the keyboard of rmacgreg@cs.strath.ac.uk (Sorcerer): :I'm trying to get the time and date using the ctime() function, but I've come :up against a rather large problem... Ctime() expects a long int as an :argument, but the manual doesn't say how or where you get this long int from. My manual says: char *ctime(const time_t *clock); usually you feed it something from the output of time(3) or perhaps the st_[acm]time fields from a stat(2) call. My time(3) looks like this: time_t time(time_t *tloc); So in general, do this: time_t now = time(0); char *cnow = ctime(&now); replace time_t with long on old systems. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "All things are possible, but not all expedient." (in life, UNIX, and perl)