Re: I'd tell you how long it'll take for my hair to fall out but I'm struggling with duration!

[email protected] (Zefram)
Newsgroups perl.datetime
Message-ID <[email protected]>
Kristian Flint wrote:
>definitely a fixed number of seconds in a day

Leap seconds.  DateTime doesn't really do them correctly -- actually its
time scale is a bit schizophrenic at the sub-second level -- but it does
represent leap seconds that it knows about.  So some days, about one in
500, have 86401 seconds.

>                                              (actually unless we're
>talking about that tiny fraction that ends up counting towards a quarter
>of a day per year?).

No.  That's a leap day occuring roughly every four years, which means
that there isn't a fixed number of days per year.

>This doesn't actually return what's stated above (#) but actually
>returns
>0 years, 41 months, 1 days, 00 hours, 375 minutes, 45 seconds

Hmm, yes.  DateTime::Duration is normalising to that form.
DT::F::Duration is only showing what it gets from DT::Duration.
Looks like DT::F::Duration is trying to normalise the other way, back
to what you input, but that's going wrong somewhere.

>And if I try and make the pattern => '%e' to just get the number of
>days, this returns 0!

Returns 1 for me.

-zefram
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.