From owner-freebsd-questions Wed Mar 14 13:20:22 2001 Delivered-To: freebsd-questions@freebsd.org Received: from bcfw1d.bridge.com (bcfw1d.ext.bridge.com [167.76.159.31]) by hub.freebsd.org (Postfix) with ESMTP id 8C05937B719 for ; Wed, 14 Mar 2001 13:20:18 -0800 (PST) (envelope-from tayers@bridge.com) Received: (from uucp@localhost) by bcfw1d.bridge.com (8.10.2/8.10.2) id f2ELLE626830; Wed, 14 Mar 2001 15:21:14 -0600 (CST) Received: from unknown(167.76.56.34) by bcfw1d.bridge.com via smap (V5.5) id xma026465; Wed, 14 Mar 01 15:20:47 -0600 Received: from mnmailhost (mnmailhost.bridge.com [167.76.155.14]) by mail1srv.bridge.com (8.8.8/8.7.3) with SMTP id PAA21744; Wed, 14 Mar 2001 15:19:41 -0600 (CST) Received: from 89-7 by mnmailhost (SMI-8.6/SMI-4.1) id QAA10413; Wed, 14 Mar 2001 16:19:37 -0500 To: Subject: Re: date time with C (off topic) References: <000701c0acc5$73eb9e50$5720fdd4@greenkey> From: Tim Ayers Date: 14 Mar 2001 15:19:37 -0600 In-Reply-To: Ertan=?iso-8859-9?q?_K=FC=E7=FCko=F0lu's?= message of "Wed, 14 Mar 2001 22:29:08 +0200" Message-ID: <7l1st5ee.fsf@tim.bridge.com> Lines: 13 User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-9 Content-Transfer-Encoding: quoted-printable Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >>>>> "E" =3D=3D Ertan K=FC=E7=FCko=F0lu writes: E> I do not have good C knowledge. I thought I just can convert the dat= e value E> I have to seconds since 1.1.1970. After that I can add seconds for o= ne day E> to the converted date value. But, I couldn't do because I couldn't m= anage E> how to calculate leap years. This approach should work fine. Use mktime(3) to convert your date into a time_t (the number of seconds since Epoch), add the number of seconds in one day, then use ctime(3), gmtime(3), or localtime(3) to convert to a struct tm so that you can get the parts of the new date. Hope you have a very nice day, :-) Tim Ayers (tayers@bridge.com) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message