need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter

Paul W. Brooks pwb at newt.phys.unsw.OZ.AU
Thu Feb 21 16:29:03 AEST 1991


In article <1991Feb18.133937.28469 at fivegl.co.nz>, hugh at fivegl.co.nz (Hugh Grierson) writes:
> In article <2323 at stsci.EDU> ansok at stsci.EDU (Gary Ansok) writes:
> >In article <6586 at gssc.UUCP> timr at 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 at 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. 



More information about the Comp.lang.c mailing list