Date: 14 Mar 2001 15:19:37 -0600 From: Tim Ayers <tayers@bridge.com> To: <questions@FreeBSD.ORG> Subject: Re: date time with C (off topic) Message-ID: <7l1st5ee.fsf@tim.bridge.com> In-Reply-To: Ertan=?iso-8859-9?q?_K=FC=E7=FCko=F0lu's?= message of "Wed, 14 Mar 2001 22:29:08 %2B0200" References: <000701c0acc5$73eb9e50$5720fdd4@greenkey>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "E" =3D=3D Ertan K=FC=E7=FCko=F0lu <ertank@softhome.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7l1st5ee.fsf>