The output of ps oddly uses a 12h timestamp in the STARTED column. This has bothered me for some time, but a FreeBSD user complaining on IRC prompted me to investigate. It appears there are three different styles of output depending on the age of the process:
Here's some example output as it currently exists:
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND root 11 100.0 0.0 0 16 - RL 10Dec14 62211:31.52 [idle] xymon 9138 0.0 0.2 20712 1868 - I 10:21AM 0:00.01 vmstat 300 2 xymon 76893 0.0 0.2 12424 1196 - Ss Mon10AM 0:03.97 /usr/local/www/xymon/server/bin/xymonlaunch
The man page seems to have it documented incorrectly as well, but the main complaint here is the use of a 12h timestamp when a 24h is more appropriate and compatible with other systems (fake edit: Linux mainly, it seems).
Under the proposed changes the above would instead look like the following:
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND root 11 100.0 0.0 0 16 - RL 10Dec14 62211:31.52 [idle] xymon 9138 0.0 0.2 20712 1868 - I 10:21 0:00.01 vmstat 300 2 xymon 76893 0.0 0.2 12424 1196 - Ss Mon10 0:03.97 /usr/local/www/xymon/server/bin/xymonlaunch
I feel this is easier to parse, though I've never been a fan of the "if less than a week print WeekdayHour" format which I would prefer to remove because it's always been confusing to read, though it does give a bit more information at a glance if you actually understand what it's saying. This is still an improvement in my eyes, nonetheless.
This patch does entirely remove the ampm functionality (r73369 by ache and r113485 by charnier). Do we rely on T_FMT_AMPM for time formatting is globally? If not, it doesn't seem like a POLA violation. The 12h format does feel like an old, ignored POLA violation instead...
So as a result, this change does bring us to be more compatible with GNU/Linux's ps output as seen below:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 19352 1548 ? Ss Jan05 0:03 /sbin/init root 26850 0.0 0.1 106480 7124 ? Ss 08:20 0:00 sshd: a0s02t [priv]
...but GNU/Linux doesn't have the WeekdayHour format, so if we care enough for full compatibility it should be removed.
For the record, this would mean
FreeBSD uses: %H:%M, %a%H, and %e%b%y which seems more readable
OpenBSD uses: %l:%M%p, %a%I%p, and %e%b%y
NetBSD uses: %l:%M%p, %a%I%p, and %e%b%y
DragonFlyBSD uses: [identical to FreeBSD before this patch with the ampm code]
Linux uses: %H:%M and %b%d according to STIME in http://procps.cvs.sourceforge.net/viewvc/procps/procps/ps/output.c?revision=1.65&view=markup
I have not yet compared with the output of Solaris or any other *nix as I don't have access at the moment, but comments in the Linux procps code mention that Solaris has spaces in their output which isn't supposed to be allowed (by POSIX?)
I'm hoping this doesn't turn into a bikeshed, so feel free to tell me this is a terrible idea. :-)
I don't know who all should be added to reviewers, but trasz has made quite a few edits to this file.