Process::MetricsSourceProcessMetrics

module Metrics

Nested

Definitions

def self.duration(value)

Parse a duration string into seconds. According to the linux manual page specifications.

Implementation

def self.duration(value)
	if match = DURATION.match(value)
		days = match[:days].to_i
		hours = match[:hours].to_i
		minutes = match[:minutes].to_i
		seconds = match[:seconds].to_i
		fraction = match[:fraction].to_i
		
		return days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60 + seconds + fraction / 100.0
	else
		return 0.0
	end
end