"The captain says: I'm a caveman"

TorgoX on 2003-01-20T01:05:22

Dear Log,

So, looking for something to do other than work on the book, I fiddled around and made a program that uses Astro::Sunrise to make a graph of sunrise and sunset times over the course of the year, for Juneau, and anywhere else I give coordinates for.

Along the way, I found some bugs in Astro::Sunrise, which more or less show up only as you get toward the poles. The notable bug was that when you ask for when the sun rises on a particular day, one of the intermediate calculations uses some Math::Trig functions that don't behave quite as expected in some cases. Normally all is well -- but what if you're in Barrow, Alaska (above the Arctic Circle) in winter or summer, and you ask the question "when is sunrise (or sunset) today?". The answer is, there isn't one. But this wasn't being explicitly checked for in Astro::Sunrise. So in a very mathy way, one of the Math::Trig functions starts returning a complex number at that point, which makes everything in Astro::Sunrise after that go screwy and scream warnings. So I inserted some checks for such cases (making them return undef, in line with how some other checks in there already work), also fixed some TZ math stuff (so if sundown isn't until 1:10am, it shows up as 01:10, not 25:10), prettied up the docs, and sent off a patch to the guy.

Meanwhile, I sent Gisle a patch to improve error reporting in HTML::Entities. And while I was at it, I added a function to HTML-escape things numerically instead of nominally (&#Xhexnum; instead of &foo;), and also added a few more examples to the docs. The silliest that I added was an example of HTML-escaping the string "vis-à-vis Beyoncé's naïve papier-mâché résumé".

Thus far I have survived almost an entire month without Tivo. It's like living in CAVEMAN TIMES!


Re: "The captain says: I'm a caveman"

jmcnamara on 2003-01-20T09:08:56

This is the time. And this is the record of the time.