Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!metro!usage.csd.unsw.oz.au!newt.phys.unsw.OZ.AU!pwb From: pwb@newt.phys.unsw.OZ.AU (Paul W. Brooks) Newsgroups: comp.lang.c Subject: Re: need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter Summary: leap year? Message-ID: <1103@usage.csd.unsw.oz.au> Date: 21 Feb 91 05:29:03 GMT References: <368@bria> <1991Feb18.133937.28469@fivegl.co.nz> Sender: news@usage.csd.unsw.oz.au Distribution: comp Lines: 25 In article <1991Feb18.133937.28469@fivegl.co.nz>, hugh@fivegl.co.nz (Hugh Grierson) writes: > In article <2323@stsci.EDU> ansok@stsci.EDU (Gary Ansok) writes: > >In article <6586@gssc.UUCP> timr@gssc.UUCP (Tim Roberts) writes: > >>> int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; > > >>int mdays[12] = { 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; : : : > >suppose it's possible), the benefits of the first in readability and > >maintainability far outweigh any speed gained by the second. > > Maintainability???? How often *do* you have to change the number > of days in a month????? (Sept 1752 notwithstanding) And how many times do you have to account for leap years? With the first form, if leap year add 1 to mdays[1]. With the second form add 1 to each of mdays[1] to mdays[11]. I know which I'd rather! Paul Brooks |Internet: pwb@newt.phys.unsw.edu.au Uni. of N.S.W. |If you have trouble sleeping, try lying on the end of Kensington NSW 2033| your bed. With a little luck you'll drop off. AUSTRALIA | - Mark Twain.