I'm not sure how many of you subscribe to MJD's Perl
Quiz-of-the-week, but this week it concerns datetime and what he
calls 'Greek Time'. Basically midnight = midnight and noon = noon.
However 6pm (greek) = sunset. This means that night hours are longer
in winter and day hours are longer in summer.
In his question, he assumes that each period (night/day) should be
evenly divided into 12 parts. However this stinks to me! Surely in
the middle of winter, the hour before sunrise shouldn't be a heap
longer than the hour after? Surely the lengths of hours should slowly
decrease towards noon and then increase again towards midnight. I
figured this is a sine wave.
However when I thought about it I realised it wasn't. But what is the
conversion? At the equinoxes, it (should) be a straight line graph.
However as sunrise gets later, it becomes a half-sine-wave. The skew
based on sunrise/set times.
The question is this: How does one turn a sine wave into a straight
line slowly? There must be a mathematical function that allows us to
create a formula to get the 'percentage of daylight' at any point in
the day. (I'm not talking observed daylight but some theoretical
daylight that puts 50% at sunrise and set)
Cheers!
Rick
--
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