develooper Front page | perl.datetime | Postings from March 2003


Thread Next
Rick Measham
March 30, 2003 00:56
Message ID:
I previously mentioned my intention to do this next, and I'm going to 
give it a go. Its a HELL of a lot harder than I imagined. For this 
reason version 1.0 will only include immovable dates.

I'm not too sure about the module name yet. Possibles are:

Here's why I'm not including everything like saints days:

Imagine this:
April 19th is St Larry day.
April 20th is All DateTimers day.

Now in 2003, Easter is April 20th.

Easter is more important than Saints days so the Saints have to move 
to the next available (non-immovable) day. The next free day is April 
23rd 2003 (Easter Monday and Easter Tuesday are a part of Easter). So 
we move St Larry to April 23 this year.

The next clash is that All DateTimers day should be on the 20th, but 
that's Easter Day, so we move it to the next free day. April 24th? 
Nup, from what I've read we move the more important days first. Thus 
we move All DateTimers Day to April 23rd and St Larry day to April 

Now in our brains we can work this out. But a computer? Well if you 
ask it 'When is St Larry Day', the easy response is "April 19th".

But if we ask it 'When is St Larry Day 2003', we have FUN!

First we check our list of immovables (Easter, Christmas, Asscention 
and others). If it doesn't conflict we're fine. We return it.

If it conflicts, we move it to the next Free day. To get the next 
free day, we have to find out if anything is happening for each day 
from the next day forward.

Finally we find the 23rd is Free. However now we have to go back to 
the immovable days and see if there's anything else in there that 
also needs moving.

We find All DateTimers day is in there, so we move it to April 23rd. 
We find St Rolsky day is the 21st, but its no more or less important 
than St Larry's day.

With all this happening, I'm thinking of a disk cache for days we've 
seen before. It just seems to be too much computing going on to just 
recalculate for each event!


             There are 10 kinds of people:
   those that understand binary, and those that don't.
   The day Microsoft makes something that doesn't suck
     is the day they start selling vacuum cleaners
"Write a wise proverb and your name will live forever."
    -- Anonymous

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About