It it now a leap year?

Alan Cox alan at lxorguk.ukuu.org.uk
Wed Aug 8 17:06:49 UTC 2007


On Wed, 08 Aug 2007 12:31:23 -0400
Mike - EMAIL IGNORED <m_d_berger_1900 at yahoo.com> wrote:

> Is there a system call or variable that will
> tell me if it is now a leap year, or should I
> do the arithmetic?

The math someone depends upon where you are but you can do it that way.
Be very careful however that you work from years not seconds or you'll
get it wrong (not all minutes are 60 seconds long)

localtime() will give you a year/day, the rest is up to you and depends a
lot on your choice of Calendar - Gregorian/Revised Julian (although these
split at 2800) etc, and of course quite a few of them don't have leap
days, some move months around and the iranian calendar is a work of art.

Viz: if you are going to localise your program you might want to keep its
knowledge of calendaring neatly seperated.




More information about the users mailing list