[Bug 192573] New: [patch] add ps(1) option to print process start time in seconds since 1970

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 11 08:11:37 UTC 2014


            Bug ID: 192573
           Summary: [patch] add ps(1) option to print process start time
                    in seconds since 1970
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: dave at daveeddy.com

Created attachment 145651
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=145651&action=edit
code patch for ps(1)

This patch adds a field (sstart) to ps(1) to print the time, in seconds since
January 1st 1970, when a process started.

On Solaris (and the same works on Linux I believe), you can stat(2) /proc/<pid>
and inspect the mtime of the directory to determine this information, however
on BSD (1) /proc doesn't set the mtime on these directories and (2) /proc is
most-likely going to be removed in future releases.


Simple example useful for scripting

$ ./ps -p $$ -o sstart=

All "started" fields currently available for the current process

$ ./ps -p $$ -o start,lstart,sstart
10:07PM Sun Aug 10 22:07:04 2014 1407708424

`sstart` is the most convenient for scripting purposes.

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list