Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!cvedc!gssc!timr From: timr@gssc.UUCP (Tim Roberts) Newsgroups: comp.lang.c Subject: Re: need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter Message-ID: <6586@gssc.UUCP> Date: 11 Feb 91 17:56:02 GMT References: <368@bria> Distribution: comp Organization: Graphic Software Systems, Inc. Beaverton, Or. Lines: 16 > int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; I have seen this construct in date solutions several times over the past two weeks. In my experience, it is almost always better to use an array of the _accumulated_ days through the end of the month, rather than the actual days in the month. This generally lets one eliminate at least one loop. For example: int mdays[12] = { 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; -- timr@gssc.gss.com Tim N Roberts, CCP Graphic Software Systems Beaverton, OR This is a very long palindrome. .emordnilap gnol yrev a si sihT