That's ok, his way also seems like a lot of work ;p
I prefer cftime or for string safety strftime. Check the corrisponding man
pages, but as an example a simple
{
string[1024];
cftime(string, "%T on %A, %B %e, %Y\n", time(NULL));
puts(string);
}
Gives the following :
02:05:43 on Monday, March 22, 2004
~Kender
--- Dale Kingston <[EMAIL PROTECTED]> wrote:
> Well, when you don't know all of the associated things that work with time,
> you tend to make your own. Had I known about that I would have used that. :P
>
>
> ----- Original Message -----
> From: "Jason Gauthier" <[EMAIL PROTECTED]>
> To: "Dale Kingston" <[EMAIL PROTECTED]>; <[email protected]>; "Cyhawk"
> <[EMAIL PROTECTED]>
> Sent: Sunday, March 21, 2004 6:29 PM
> Subject: RE: showing time
>
>
> > Dang, that seems like a lot of work.
> >
> > Standard C functions give you this ability.
> >
> > char *printdate(void)
> >
> > {
> >
> > struct tm *tp;
> >
> > static char date[80];
> >
> > time_t thetime = time(NULL);
> >
> > tp = localtime(&thetime);
> >
> >
> >
> > sprintf(date, (char *)"%d/%d/%02d %d:%02d:%02d", 1 + tp->tm_mon,
> > tp->tm_mday,
> > tp->tm_year % 100, tp->tm_hour, tp->tm_min,tp->tm_sec);
> >
> > return date;
> >
> > }
=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html