Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

rjbs
  (email not shown publicly)
http://rjbs.manxome.org/
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Monday October 23, 2006
10:21 AM

datetime dorkiness

[ #31394 ]

I have long avoided DateTime. It's not that I had any specific reason to dislike the module's interface or offerings, except that it could not be easily installed via PPM on ActivePerl. When I was developing code that I deployed onto Windows via PPM, this was a major problem, and so I stuck to other Date:: and Time:: modules.

Installing DateTime kept me away from it for a few other uses, too. It often seemed easier to just use something ugly like Date::Calc or Date::Parse (but never Date::Manip) than to install DateTime.

This week, I've finally started using it. Actually, I've written a DateTime::Calendar module. What has driven me to start using it? Well, my RPG, of course! Official interplanetary timekeeping is done in Standard Time, which is generally expressed in years since the Standard epoch. So, for example, the execution of Nazar Barbari occurred at approximately 160.400. We could also express that as 160:05:23:09:36:00 or 4656476160 sec. I can also convert it to various other "real life" calendar systems.

The only thing I haven't implemented yet is the semi-mandatory from_object method that will let me convert other DateTime dates to Standard Time. I'm looking forward to that, since it will (hopefully) let me store the entire game timeline in a standard format.

The next level of dorkiness will be more gruelling: local calendars. After all, while having a standard timekeeping system is useful, people still want a roughly solar year. DateTime should make it simple to construct similar-but-distinct planetary (or municipal) calendars driven by some YAML files.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I switched to DateTime from Time::Piece when I designed my own lunisolar calendar, which sees no use at all other than by myself. (And my wife, who has to put up with this crap.)

    I'm a pathetic geek. :)

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
  • charsbar has set up his PPM repository at http://ppm.tcool.org/ [tcool.org] where he has PPM for lots of useful CPAN modules up-to-date. It has DateTime also.