Here's an implementation with higher performance (does not need to execute a new process per line, sorts oldest process as the last):
ps -eo etimes,pid,args --sort=etimes | awk 'BEGIN{now=systime()} {$1=strftime("%Y-%m-%d %H:%M:%S", now-$1); print $0}'
and this allows pretty easily to change column ordering, too. For example pid, etimes, arg. And to primary sort by pidstart time and secondary sort by start time (of course, pid is unique so start time doesn't really matter for this example), you can do something like:
ps -eo pid,etimes,args --sort=pid,sort=-etimes,pid | awk 'BEGIN{now=systime()} {$2=strftime("%Y-%m-%d %H:%M:%S", now-$2); print $0}'
It seems that at least with ps from procps-ng 3.3.12 the(the --sortetimes flag doesn't seem tomust be stable. To workaround that and primary sort by starttime and secondary sort by pidsorted in reverse because it's actually count of seconds in the past for the process start time, do something like this: should match the actual execution order of the processes except if PID counter overflows on the same second for multiple processes).
ps --no-headers -eo etimes,pid,args | awk 'BEGIN{now=systime()} {$1=strftime("%Y-%m-%d %H:%M:%S", now-$1); print $0}' | sort -k1,2 -k3h