Date: Wed, 11 Aug 2004 00:08:26 +0200 (MEST) From: Mipam <mipam@ibb.net> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: freebsd-questions@freebsd.org Subject: Re: localtime question Message-ID: <Pine.BSO.4.56.0408110007450.16484@ux11.ltcm.net> In-Reply-To: <20040810171256.GA26475@orion.daedalusnetworks.priv> References: <Pine.BSO.4.56.0408101646230.26666@ux11.ltcm.net> <20040810162612.GC25389@orion.daedalusnetworks.priv> <Pine.BSO.4.56.0408101842210.21307@ux11.ltcm.net> <20040810171256.GA26475@orion.daedalusnetworks.priv>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 10 Aug 2004, Giorgos Keramidas wrote: > On 2004-08-10 18:45, Mipam <mipam@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@orion[20:11]/home/keramida$ ./a.out > Mon Aug 9 20:11:30 2004 > > keramida@orion[20:11]/home/keramida$ Thanks, for the help, i'll remove the \n and get on the sorting part now :-) Bye, Mipam.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSO.4.56.0408110007450.16484>