Re: converting between time and string

2006-06-22 Thread JupiterHost.Net
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

Re: converting between time and string

2006-06-22 Thread Mark Harris
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

Re: converting between time and string

2006-06-22 Thread Dr.Ruud
"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

Re: converting between time and string

2006-06-22 Thread Muma W.
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

converting between time and string

2006-06-22 Thread bnj.s
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