More Time::Piece

Matts on 2003-02-09T11:53:43

Now Time::Piece (porting to use base DateTime) is down to 5 tests failing. 3 of those are because DateTime doesn't support isdst (yet?) and 2 because I think DateTime.pm's implementation of day_of_year is broken (at least according to Time::Piece's test suite). The test in question creates a Time::Piece object from the epoch 951827696 which is "2000-02-29T12:34:56" (note it's feb 29th), and the day_of_year for Time::Piece is supposed to return 59, whereas DateTime's API returns 61 (it's offset is different, so using the same offset that's 60).

Counting up (31 days in January, 29 in Feb) I see no way it could be 61, no matter where you start.

Still, DateTime.pm isn't even at 0.01 yet (it's 0.01_00), so at least everything else works nicely.


Yup, that's a bug

autarch on 2003-02-09T16:59:00

I fixed it. I'll release a new version soon.

Re:Yup, that's a bug

Matts on 2003-02-09T17:30:58

Are you going to support isdst too? That would be nice as I don't really know how to implement it at the Time::Piece level.

Re:Yup, that's a bug

autarch on 2003-02-09T19:12:33

I can add is_dst to DateTime::TimeZone. It doesn't really make sense as a DateTime.pm attribute, though, since DST can only be determined in the context of the given zone. Does that seem reasonable?

BTW, it'd be best to discuss this on the datetime@perl.org list ;)

Re:Yup, that's a bug

Matts on 2003-02-09T20:23:07

Well it's a combined feature of the time and the timezone, so I suspect it's best left in DateTime.pm, either that or you're going to have to pass a DateTime object into your $timezone->is_dst() method.

Whatever you decide on though I'll make it work in Time::Piece.

(and yes I know I should join the list, but I just don't have time right now, so I'd rather get Time::Piece working with DateTime without joining if I can, and it seems I can :-)

Re:Yup, that's a bug

autarch on 2003-02-09T20:36:49

My last post didn't make much sense. Sorry.

What I mean was that I can implement DateTime->is_dst, but under the hood it will actually get that info from a DT::TimeZone object. And the only kind of time zone object that will ever return true is_dst is one based on the Olson DB. So an offset only time zone will always return is_dst of 0.

Does that make more sense?

Anyway, see DateTime.pm 0.03, which I just uploaded to CPAN. It implements DateTime->is_dst.