[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

localtime question



On Tue, 10 Aug 2004, Giorgos Keramidas wrote:

> On 2004-08-10 18:45, Mipam <mipam_(_at_)_ibb_(_dot_)_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.