# Time constants module - standard-library fodder?

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Mon Jun 2 01:27:32 CEST 2003

```On Fri, 30 May 2003 10:45:07 +0200, Irmen de Jong wrote:
> Ben Finney wrote:
>> DAYS_PER_YEAR_AVG = 365.25
>> DAYS_PER_MONTH_AVG = DAYS_PER_YEAR_AVG / MONTHS_PER_YEAR
>> WEEKS_PER_YEAR_AVG = DAYS_PER_YEAR_AVG / DAYS_PER_WEEK
> [...]
> > SECS_PER_MONTH_AVG = DAYS_PER_MONTH_AVG * SECS_PER_DAY
> > SECS_PER_YEAR_AVG = DAYS_PER_YEAR_AVG * SECS_PER_DAY
>
> I'm not happy with this: it's wrong. The avg. number of days per year
> is 365.242199. Second, there's also a Siderial year, 365.256366 days.
> Sometimes you need the first, sometimes the other.

Indeed.  The 365.25 is a "compromise" between the tropical and siderial
years (very close to the mean average of the two lengths), rather than
forcing one or the other, or forcing the programmer to choose one and
learn about the difference between the two.

I'm in full agreement that it's sub-optimal, and "wrong".  All the more
reason for a more-standard set of constants (that have already been
pointed to in another post, to come in Python 2.3).

> Perhaps you require even greater precision than 6 fractional digits.
> Either remove these constants or define them exactly
> (you probably meant the Julian year).

I was aware of all these different year lengths, but chose 365.25 as a
"good enough" compromise between them all.  Not good where more
precision is required, of course, but good for its main purpose of Unix
time_t timestamping.

Rebuke accepted, though.  Going to the effort to define these constants,
without taking into account the different values for "year", was a
half-measure.

> I think you're opening a can of worms here ;-)

Thanks for that.  My primiary reference has been:

Calendar FAQ
<http://www.tondering.dk/claus/cal/>

I'll add the reference you gave to my list :-)

--
\     "Remember men, we're fighting for this woman's honour; which is |
`\                probably more than she ever did."  -- Groucho Marx |
_o__)                                                                  |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B

```