Hello,

DateTime::Duration exactly what I need. But I miss the divide operator.
Why is the divide operator not overloaded? I would need it. 

To imitate the divide operator (object / number) I used the
multiplication operator ( object * (1/number) ). But doing it this way I
do not get the correct result.

Here I have some code doing this:

---------
use strict;
use warnings;

use DateTime::Duration;
use DateTime::Format::Duration;

my $f = DateTime::Format::Duration->new(pattern => '%M:%S,%2N',
                                                                                
normalise => 1);

my $dur = DateTime::Duration->new( minutes => 34, seconds => 48,
nanoseconds => 140000000);

$dur = $dur * (1/25);
print $f->format_duration($dur); # 01:22,00 --> wrong result
print "\n";

$dur = $dur * 25;
print $f->format_duration($dur); # 34:25,14
print "\n";
-------

Am I doing something wrong or is it a bug?

Thank you very much for your help.
Dirk



Reply via email to