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.
521 522 523 524 525 526 527 |
# File 'lib/linux_stat/process_info.rb', line 521 def start_time(pid = $$) # Getting two Time objects and dealing with floating point numbers # Just to make sure the time goes monotonically _ste = start_time_epoch(pid) return nil unless _ste Time.at(_ste) end |