From owner-freebsd-questions@FreeBSD.ORG Tue Aug 10 22:08:33 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FB8C16A4CE for ; Tue, 10 Aug 2004 22:08:33 +0000 (GMT) Received: from ux11.ltcm.net (ux11.ltcm.net [64.215.98.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA04C43D55 for ; Tue, 10 Aug 2004 22:08:32 +0000 (GMT) (envelope-from mipam@ibb.net) Received: from ux11.ltcm.net (mipam@localhost.ltcm.net [IPv6:::1]) by ux11.ltcm.net (8.12.9/8.12.9/UX11TT) with ESMTP id i7AM8SIo013740; Wed, 11 Aug 2004 00:08:29 +0200 (MEST) Received: from localhost (mipam@localhost) by ux11.ltcm.net (8.12.9/8.12.9/Submit) with ESMTP id i7AM8QxT003830; Wed, 11 Aug 2004 00:08:27 +0200 (MEST) X-Authentication-Warning: ux11.ltcm.net: mipam owned process doing -bs Date: Wed, 11 Aug 2004 00:08:26 +0200 (MEST) From: Mipam X-X-Sender: mipam@ux11.ltcm.net To: Giorgos Keramidas In-Reply-To: <20040810171256.GA26475@orion.daedalusnetworks.priv> Message-ID: References: <20040810162612.GC25389@orion.daedalusnetworks.priv> <20040810171256.GA26475@orion.daedalusnetworks.priv> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org Subject: Re: localtime question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2004 22:08:33 -0000 On Tue, 10 Aug 2004, Giorgos Keramidas wrote: > On 2004-08-10 18:45, Mipam wrote: > > #include > > #include > > > > 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.