I'm struggling to convert a duration in format HH:MM:SS.NNNNNNN to seconds in a concise manner.
For example, 01:03:01.8231963 should convert to 97381.8231963 seconds.
The convert function dur2sec supports the format [D+]HH:MM:SS while the mstime function supports the format [MM:]SS.SSS however there isn't a single function to support my format.
I've come up with the following solution where cputime is the field I am trying to convert, however, it feels like there should be a simpler way.
| rex field=cputime "(?<cputime_s>\d+\:\d+\:\d+)(?<cputime_ms>\.\d+)"
| convert dur2sec(cputime_s)
| eval cputime_s=cputime_s+tonumber(cputime_ms)
... View more