localtime question
Mipam
mipam at ibb.net
Tue Aug 10 15:08:33 PDT 2004
On Tue, 10 Aug 2004, Giorgos Keramidas wrote:
> On 2004-08-10 18:45, Mipam <mipam at ibb.net> wrote:
> > #include <stdio.h>
> > #include <sys/time.h>
> >
> > int main(void)
> > {
> > struct timeval tv;
> > struct timeval tv_current;
> > if (gettimeofday(&tv_current, NULL) == -1)
> > err(1, "Could not get local time of day");
> > tv.tv_sec = tv_current.tv_sec-86400;
> > printf("%s\n", ctime(&tv.tv_sec));
> > return 0;
> > }
>
> Hmmm, now that I noticed. You don't need to add a trailing '\n' to the
> string of ctime(). It already has one:
>
> keramida at orion[20:11]/home/keramida$ ./a.out
> Mon Aug 9 20:11:30 2004
>
> keramida at orion[20:11]/home/keramida$
Thanks, for the help, i'll remove the \n and get on the sorting part now
:-)
Bye,
Mipam.
More information about the freebsd-questions
mailing list