[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-datetime
Subject:    Re: Today in Cairo Apr 25 2008
From:       Dave Rolsky <autarch () urth ! org>
Date:       2008-02-19 23:38:28
Message-ID: alpine.DEB.0.9999.0802191735530.7485 () urth ! org
[Download RAW message or body]

On Wed, 20 Feb 2008, Dr.Ruud wrote:

> Maybe add a "safe => 1" (with new, add, subtract) such that the 
> following don't die() anymore:

I'm not too keen on this, because it clutters up the API and puts too much 
burden on the end user to know about the possibility of "unsafe" datetime 
math.

Either the operations should be safe by default, or unsafe by default, in 
which case there should be a documented workaround.

In fact, the workaround is to convert the object to UTC before doing any 
math on it, which may or may not get the results you want.

> Somewhat related: Maybe also add a newdate() that carries no time
> information.

You can effectively get this by simply using the floating time zone and 
never setting or altering any time components of the object.

If I had it to do all over again (which I guess I will if I work on this 
stuff for Perl 6), then I'd make a DateTime::Date class and simply use 
that class as part of DateTime::DateTime (err, names pending review).


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic