Method: LinuxStat::ProcessInfo.start_time

Defined in:
lib/linux_stat/process_info.rb

.start_time(pid = $$) ⇒ Object

start_time(pid = $$)

Returns the time (as Time object) the process was started.

For example:

LinuxStat::ProcessInfo.start_time 14183

=> 2020-12-16 13:31:43 +0000

If the info isn’t available or the argument passed doesn’t exist as a process ID, it will return nil.

The timezone returned based on current TZ. Thus the timezone could be affected by changing the ENV variable.

Don’t trust the timezone returned by the time.



602
603
604
605
606
# File 'lib/linux_stat/process_info.rb', line 602

def start_time(pid = $$)
	# Getting two Time objects and dealing with floating point numbers
	# Just to make sure the time goes monotonically
	Time.at(start_time_epoch(pid))
end