Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!spool.mu.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter Message-ID: <611@taumet.com> Date: 22 Feb 91 16:13:48 GMT References: <368@bria> <1991Feb18.133937.28469@fivegl.co.nz> <1103@usage.csd.unsw.oz.au> Distribution: comp Organization: Taumetric Corporation, San Diego Lines: 24 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) But what about when the program isn't working? As Kernighan and Plauger point out in "The Elements of Programming Style", it is easy to look at the first version and know it is right ("Thirty days hath September," etc). This allows you to move on to look for errors elsewhere. Quick Quiz: is the second version (31, 59, ...) quoted in this posting correct? Did I change any of the numbers accidently (or on purpose)? To find out, you have to do some arithmetic. -- Steve Clamage, TauMetric Corp, steve@taumet.com