FAQ
Hi,

The documentation does not specify what What does
DateTime::Duration->compare() returns.

From some testing I've done it seems like it

    - 1 if the first duration is larger than the second,
    - 0 if the durations are equal
    - -1 is the second duration is larger than the first

Can anyone confirm this, and possibly update the documentation?

Documentation is found here:
http://search.cpan.org/~drolsky/DateTime-1.03/lib/DateTime/Duration.pm#DateTime::Duration->compare(_$duration1,_$duration2,_$base_datetime_)

Kind regards,
Andreas Isberg
Telefon: 072-588 91 95

Search Discussions

  • Rick Measham at Oct 11, 2013 at 6:22 am
    Hi Andreas,

    It does need to be documented, but to explain:
    $dt->compare follows the behavior of `cmp` and ``.

    - Rick

    On Thu, 10
    Oct 2013 10:07:02 +0200, Andreas Isberg wrote:
    Hi,
    The
    documentation does not specify what What does
    DateTime::Duration->compare() returns.
    From some testing I've done it
    seems like it
    * 1 if the first duration is larger than the second,
    * 0 if the durations are equal
    * -1 is the second duration is
    larger than the first
    Can anyone confirm this, and possibly update
    the documentation?
    Documentation is found here:
    http://search.cpan.org/~drolsky/DateTime-1.03/lib/DateTime/Duration.pm#DateTime::Duration->compare(_$duration1,_$duration2,_$base_datetime_)
    [1]
    Kind regards,
    Andreas Isberg

    Telefon: 072-588 91 95
    Message protected for iSite by MailGuard: e-mail anti-virus,
    anti-spam and content filtering.
    http://www.mailguard.com.au [2]
    Report this message as spam [3]



    Links:
    ------
    [1]
    http://search.cpan.org/~drolsky/DateTime-1.03/lib/DateTime/Duration.pm#DateTime::Duration->compare(_$duration1,_$duration2,_$base_datetime_)
    [2]
    http://www.mailguard.com.au/rm
    [3]
    https://login.mailguard.com.au/report/1I9kqknXTc/2eG4yrlviF9PLZ81IBzAU4/0.002
    --
    Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and content filtering.http://www.mailguard.com.au

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdatetime @
categoriesperl
postedOct 10, '13 at 8:07a
activeOct 11, '13 at 6:22a
posts2
users2
websitemetacpan.org...

2 users in discussion

Rick Measham: 1 post Andreas Isberg: 1 post

People

Translate

site design / logo © 2019 Grokbase