Of course!  Here's a patch of php_date.c (currently based off 5.3.2; I'll
need to rebase off 5.3.3 of course) showing the seasonal equinox support
I've added thus far.  The formulas in there took quite a bit of research to
find, but ultimately I was able to find them in an old book titled,
"Astronomical Algorithms" by Jean Meeus.  It's apparently considered the
definitive text on the subject and is used by organizations such as NASA to
calculate the seasons.  The formulas are accurate to within a few seconds up
to the year AD 3000, but should be accurate to within a few minutes for
several thousand years after that.  I've already tested this and it works
perfectly thus far.

Currently, the only thing these new functions are being used for is to
display the season for a given date (northern hemisphere only; southern I'm
still working on).  To test it, simply use date( "v" ); to display the
current season or for a given timestamp.  I chose the letter "v" for
"vuodenaika", which is the Finnish word for "season".  I can also send a
test PHP script I wrote so you can visually compare the seasonal equinoxes
identified with your calendar or whatever to verify its accuracy.  That
reminds me, I still need to make that into a PHPT case....

The equinoxes are currently rounded to midnight of that given day, though
this can easily be changed to be accurate down to the second since the
functions are already in place.  I'm not sure which would be better though,
so I figured I'd ask around and see what y'all think about that one.

This is just one avenue I'm currently pursuing and I expect to be doing much
more as time permits.  Professionally, I work as a PHP test engineer for a
major software company and most recently was working closely with Pierre on
testing and debugging issues with the Win32 5.3.3 and 5.2.14 RC's.  He
hasn't seen any of my programming work as that's not what I do here, nor
have I discussed this SVN request with him since it's just for me
personally, but if you're looking for someone who can vouch for my character
and professionalism at least I'm sure he'd be willing to mention that if
asked.  Just to clarify again the source development work I'm doing on the
PHP core/etc is just me acting on my own personal behalf and not for any
company/etc.


Please don't hesitate to ask if there's anything else you need from me to
move this application forward.  Thanks!  =)

--Kris


2010/8/10 Johannes Schlüter <johan...@php.net>

> On Mon, 2010-08-09 at 18:19 -0700, Kris Craig wrote:
> > Currently, I'm working on several parallel feature additions to the date
> extension.
>
> Can you please send some patches first? We like to see some work before
> handing out accounts.
>
> johannes
>
>
>

Reply via email to