On Tue, 17 Feb 2009, Geoffrey Broadwell wrote:
On Tue, 2009-02-17 at 22:38 +1100, Timothy S. Nelson wrote:
My third thought is that it would be very useful also to have
date/time objects that integrate well with eg. ctime, mtime, and the like; I'd
start with Time::Piece as a model.
http://search.cpan.org/dist/Time-Piece/Piece.pm
Conceptually, I agree. But there are places that Time::Piece assumes
time is a sane thing, and it just isn't. Date::Time has a less DWIM
interface, but is much more correct in the face of general human
nuttiness on this topic (especially with regard to durations and
timezones).
I'd prefer to generally follow Date::Time, with DWIM features cherry
picked from Time::Piece as long as they don't result in wrong behavior.
Agreed, and that's kinda what I'm doing. But I still think there's
room for improvement. I'll try and design an API that does what DateTime
does, but:
1. Uses more variables, of which I expect the getters and setters to be
overridden.
2. Documents in terms of operator overloading
3. Depends a lot more on CLDR formats
4. Doesn't have multiple functions that perform exactly the same thing
5. As a consequence of all of the above, has a lot fewer functions (while
still providing all the same functionality).
(As an aside: It's the 21st century -- the default stringification of
time objects should be easily parseable and sortable, not the insanity
produced by Perl 5's 'scalar localtime'. ISO or SQL timestamp format
please.)
Fine by me.
---------------------------------------------------------------------
| Name: Tim Nelson | Because the Creator is, |
| E-mail: wayl...@wayland.id.au | I am |
---------------------------------------------------------------------
----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V-
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----