$ptime (parse-spec) function
This function returns the time in milliseconds associated with an ISO-formatted period time value selected by the parse specification argument. The ISO-formatted time is in the standard format of PHHH:MM:SS.mmm. This parse function is mainly useful for parsing out performance counter values that occur in certain BMC Defender agent messages, where this time representation is extensively used. The value can have any number of leading hours or trailing milliseconds, but the minutes and second values should range from 00 to 59. If the parsed value is not an ISO time value, no time value is returned.
The following examples show target strings, parse expressions, and return values:
Target string | Parse expression | Return value |
|---|---|---|
CPU: P0:00:00.25
| $ptime (CPU: *) | 250 Exaplanation: The ISO time value represents 250 milliseconds elapsed time. |
Time: P1:00:00.0 | $ptime (Time: *) | 3600000 Exaplanation: The ISO time value represents one hour in milliseconds. |
Time: P1:00:00:00 | $scale ($ptime (time: *), .001, 0) | 3600 Exaplanation: The $scale() function is applied to divide the time by 1000 to represent elapsed seconds. For more information, see scale-parse-spec-fmultiplier-foffset-function. |
Value: P100:00 | $ptime (value: *) | No match Exaplanation: The parsed value is not in ISO format. |
Related topic