From owner-freebsd-chat Wed Mar 25 01:58:06 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA11310 for freebsd-chat-outgoing; Wed, 25 Mar 1998 01:58:06 -0800 (PST) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from ren.dtir.qld.gov.au (firewall-user@ns.dtir.qld.gov.au [203.108.138.66]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id BAA11251; Wed, 25 Mar 1998 01:57:58 -0800 (PST) (envelope-from syssgm@dtir.qld.gov.au) Received: by ren.dtir.qld.gov.au; id TAA24784; Wed, 25 Mar 1998 19:56:43 +1000 (EST) Received: from ogre.dtir.qld.gov.au(167.123.8.3) by ren.dtir.qld.gov.au via smap (3.2) id xma024779; Wed, 25 Mar 98 19:56:14 +1000 Received: from troll.dtir.qld.gov.au (troll.dtir.qld.gov.au [167.123.8.1]) by ogre.dtir.qld.gov.au (8.8.7/8.8.7) with ESMTP id TAA08866; Wed, 25 Mar 1998 19:55:54 +1000 (EST) Received: from localhost (syssgm@localhost) by troll.dtir.qld.gov.au (8.8.5/8.8.5) with SMTP id TAA13470; Wed, 25 Mar 1998 19:55:58 +1000 (EST) Message-Id: <199803250955.TAA13470@troll.dtir.qld.gov.au> X-Authentication-Warning: troll.dtir.qld.gov.au: syssgm@localhost didn't use HELO protocol To: "Jonathan M. Bresler" cc: freebsd-chat@FreeBSD.ORG Subject: Re: y2k Date: Wed, 25 Mar 1998 19:55:58 +1000 From: Stephen McKay Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Jonathan M. Bresler wrote: >Swerda wrote: >> i dont believe 2000 is a leap year I just close my eyes and wish! http://www.ast.cam.ac.uk/RGO/leaflets/leapyear/leapyear.html is brief, but informative, including a bit of the history of calendars. >> a leap year is divisible EVENLY BY 4 >> except NOT one divisible by 400 > > 2000 is a leap year. > > if (year % 400 == 0 || > (year % 100 != 0 && year % 4 == 0)) > printf("leap year\n"); But, of course, for that little bit of efficiency, you should code it: if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) printf("leap year\n"); so that for 3 out of 4 years only one division and comparison is done. Stephen. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message