[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ProgSoc] Getting the time and ports
On Tue, May 30, 2000 at 10:39:59AM +1000, Chocky wrote:
> On Tue, 30 May 2000, Matt Beauregard wrote:
>
> > On Tue, May 30, 2000 at 10:19:38AM +1000, Chocky wrote:
> > > On Tue, 30 May 2000, gleNN wrote:
> > >
> > > > On Tue, 30 May 2000, Chocky wrote:
> > > >
> > > > > Does anyone know how to get the current time in a string format in C? I
> > > > > seem to have forgotten how...
> > > >
> > > > man ctime. Returns string in the format:
> > > >
> > > > Fri Sep 13 00:00:00 1986\n\0
> > > >
> > > Done... but it doesn't state what the datatype time_t is, so I don't know
> > > what to pass it.
> >
> > DESCRIPTION
> > The functions ctime(), gmtime() and localtime() all take as an
> > argument a
> > time value representing the time in seconds since the Epoch
> > (00:00:00
> > UTC, January 1, 1970; see time(3)).
>
> I may be just being blond here.. but I still can't work out the datatype.
> Like if I shove an interger in I get..
>
> Reciever.c:63: warning: passing arg 1 of `asctime' makes pointer from
> integer wi thout a cast
>
> I know it a pointer of a datatype time_t... just what structure
> is time_t?
You don't need to know, you just declare one and use it... time(3)
will put some stuff in it and ctime(3) will display it...
(what it actually is varies per operating system... it tends to be a
32-bit int on 32-bit systems)
--
Rev Dr Matt Beauregard
Professional entropist and all-round family man
Available for children's parties
-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.