wrote a little script to adapt subtitles timings in .srt files, but am getting bitten by a strange extra second when using a negative offset
use strict; use warnings; use Data::Dump qw/pp dd/; use DateTime; use DateTime::Duration; my $dur = DateTime::Duration->new( hours => 0, minutes => 0, seconds => -1, nanoseconds => "000000000", ); warn "dur:\t", pp $dur->in_units( qw/hours minutes seconds nanoseconds/ ); exit;
dumps
dur: (0, 0, -1, -1000000000) at d:/tmp/t_datetime.pl line 14.
it seems that nanoseconds are getting wrong, not sure if I misunderstood the docs for DateTime::Duration ...
This problem disappears if nanoseconds are missing or set to something else than 0, hence I do have an easy workaround.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |