Hello,
$refTime = "01:22:33,456"; #as in your example
$refTime =~ /(\d+):(\d+):(\d+),(\d+)/; #capture the elements and assign
$hours = $1;
$minutes = $2;
$secs = $3;
$mili = $4;
or much simpler:
my($hours, $minutes, $secs, $mili) = $ref_time =~ m{(\d+)}g;
Note that if it doesn't match then t
bnj.s wrote:
Hello,
I have a file with lots of times in the format "01:22:33,456", where the
numbers after the comma represent the milliseconds.
I would like to reduce all these times by a given offset. I first
thought to convert the string to a sort of date format, and then to do a
minus o
"bnj.s" schreef:
> I have a file with lots of times in the format "01:22:33,456", where
> the numbers after the comma represent the milliseconds.
>
> I would like to reduce all these times by a given offset. I first
> thought to convert the string to a sort of date format, and then to
> do a minus
bnj.s wrote:
Hello,
I have a file with lots of times in the format "01:22:33,456", where the
numbers after the comma represent the milliseconds.
I would like to reduce all these times by a given offset. [...]
You can use POSIX::mktime to convert the string into a time value, but
the millis
Hello,
I have a file with lots of times in the format "01:22:33,456", where the
numbers after the comma represent the milliseconds.
I would like to reduce all these times by a given offset. I first
thought to convert the string to a sort of date format, and then to do a
minus operation, and