There's definitely a doc_smell here, but could the part I've emphasized (from perldoc DateTime:Duration) the documentation for this problem?

$dur->in_units( ... )
  Returns the length of the duration in the units (any of those that can
  be passed to "new") given as arguments. All lengths are integral, but
  may be negative. Smaller units are computed from what remains after
  taking away the larger units given, so for example:

    my $dur = DateTime::Duration->new( years => 1, months => 15 );

    $dur->in_units( 'years' );            # 2
    $dur->in_units( 'months' );           # 27
    $dur->in_units( 'years', 'months' );  # (2, 3)
    $dur->in_units( 'weeks', 'days' );    # (0, 0) !

  The last example demonstrates that there will not be any conversion
  between units which don't have a fixed conversion rate. 
The only conversions possible are:

  *       years <=> months

  *       weeks <=> days

  *       hours <=> minutes

  *       seconds <=> nanoseconds

  For the explanation of why this is the case, please see the How DateTime
  Math Works section of the DateTime.pm documentation

My speculation here seems almost non-sensical ... except for the module author's repeated comment, "...if you are trying to generate output suitable for humans, use the "DateTime::Format::Duration" module."


In reply to Re: DateTime::Duration not adding seconds appropriately by ww
in thread DateTime::Duration not adding seconds appropriately by biohisham

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.