Slash Boxes
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 ]

Matts (1087)

  (email not shown publicly)

I work for MessageLabs [] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Sunday February 09, 2003
06:53 AM

More Time::Piece

[ #10487 ]

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'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, isn't even at 0.01 yet (it's 0.01_00), so at least everything else works nicely.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Yup, that's a bug (Score:3, Informative)

    by autarch (914) on 2003.02.09 11:59 (#16817) Homepage Journal
    I fixed it. I'll release a new version soon.
    • 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.
      • I can add is_dst to DateTime::TimeZone. It doesn't really make sense as a 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 list ;)
        • Well it's a combined feature of the time and the timezone, so I suspect it's best left in, 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 :-)
          • 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 0.03, which I just uploaded to CPAN. It implements DateTime->is_dst.