--- old/usr/src/cmd/w/w.c	Sat Nov 30 09:38:52 2013
+++ new/usr/src/cmd/w/w.c	Sat Nov 30 09:38:52 2013
@@ -79,7 +79,7 @@
 
 /* Print minimum field widths. */
 #define	LOGIN_WIDTH	8
-#define	LINE_WIDTH	12
+#define	LINE_WIDTH	8
 
 #define	DIV60(t)	((t+30)/60)	/* x/60 rounded */
 
@@ -127,9 +127,8 @@
 static void	clnarglist(char *);
 static void	showtotals(struct uproc *);
 static void	calctotals(struct uproc *);
-static void	prttime(time_t, char *);
+static void	prttime(time_t, int);
 static void	prtat(time_t *time);
-static void	checkampm(char *str);
 
 static char	*prog;		/* pointer to invocation name */
 static int	header = 1;	/* true if -h flag: don't print heading */
@@ -308,11 +307,13 @@
 			exit(0);
 
 		if (lflag) {
-			PRINTF((dcgettext(NULL, "User     tty           "
-			    "login@  idle   JCPU   PCPU  what\n", LC_TIME)));
+			PRINTF((dcgettext(NULL, "User     tty      "
+			    "login@      idle    JCPU    PCPU    what\n",
+			    LC_TIME)));
 		} else {
 			PRINTF((dcgettext(NULL,
-			    "User     tty           idle   what\n", LC_TIME)));
+			    "User     tty      idle    what\n",
+			    LC_TIME)));
 		}
 
 		if (fflush(stdout) == EOF) {
@@ -485,13 +486,14 @@
 
 		/* print tty user is on */
 		if (lflag) {
-			PRINTF(("%-*.*s", LINE_WIDTH, LMAX, ut->ut_line));
+			PRINTF(("%-*.*s ", LINE_WIDTH, LMAX, ut->ut_line));
 		} else {
 			if (ut->ut_line[0] == 'p' && ut->ut_line[1] == 't' &&
 			    ut->ut_line[2] == 's' && ut->ut_line[3] == '/') {
-				PRINTF(("%-*.3s", LMAX, &ut->ut_line[4]));
+				PRINTF(("%-*.*s ", LINE_WIDTH, LMAX,
+				    &ut->ut_line[4]));
 			} else {
-				PRINTF(("%-*.*s", LINE_WIDTH, LMAX,
+				PRINTF(("%-*.*s ", LINE_WIDTH, LMAX,
 				    ut->ut_line));
 			}
 		}
@@ -504,11 +506,7 @@
 
 		/* print idle time */
 		idle = findidle(ut->ut_line);
-		if (idle >= 36 * 60) {
-			PRINTF((dcgettext(NULL, "%2ddays ", LC_TIME),
-			    (idle + 12 * 60) / (24 * 60)));
-		} else
-			prttime(idle, " ");
+		prttime(idle, 8);
 		showtotals(findhash(ut->ut_pid));
 	}
 	if (fclose(stdout) == EOF) {
@@ -537,14 +535,14 @@
 	if (lflag) {
 		/* print CPU time for all processes & children */
 		/* and need to convert clock ticks to seconds first */
-		prttime((time_t)jobtime, " ");
+		prttime((time_t)jobtime, 8);
 
 		/* print cpu time for interesting process */
 		/* and need to convert clock ticks to seconds first */
-		prttime((time_t)proctime, " ");
+		prttime((time_t)proctime, 8);
 	}
 	/* what user is doing, current process */
-	PRINTF((" %-.32s\n", doing));
+	PRINTF(("%-.32s\n", doing));
 }
 
 /*
@@ -646,26 +644,41 @@
 #define	MON	(30 * DAY)
 
 /*
- * prttime prints a time in hours and minutes or minutes and seconds.
- * The character string tail is printed at the end, obvious
- * strings to pass are "", " ", or "am".
+ * prttime prints a time in days, hours, minutes, or seconds.
+ * The second argument is the field width.
  */
 static void
-prttime(time_t tim, char *tail)
+prttime(time_t tim, int width)
 {
-	if (tim >= 60) {
-		PRINTF((dcgettext(NULL, "%3d:%02d", LC_TIME),
-		    (int)tim/60, (int)tim%60));
+	char value[12];
+	char *unit;
+
+	if (tim >= 36 * HR) {
+		(void) snprintf(value, sizeof (value), "%d",
+		    (tim + (DAY / 2)) / (DAY));
+		unit = dcgettext(NULL, "days", LC_TIME);
+	} else if (tim >= 36 * 60) {
+		(void) snprintf(value, sizeof (value), "%d",
+		    (tim + (HR / 2)) / (HR));
+		unit = dcgettext(NULL, "hours", LC_TIME);
+	} else if (tim >= 60) {
+		(void) snprintf(value, sizeof (value), "%d",
+		    (tim + 30) / 60);
+		unit = dcgettext(NULL, "mins", LC_TIME);
 	} else if (tim > 0) {
-		PRINTF((dcgettext(NULL, "    %2d", LC_TIME), (int)tim));
+		(void) snprintf(value, sizeof (value), "%d", (int)tim);
+		unit = dcgettext(NULL, "secs", LC_TIME);
 	} else {
-		PRINTF(("      "));
+		(void) strcpy(value, "0");
+		unit = " ";
 	}
-	PRINTF(("%s", tail));
+	width -= 2 + strlen(value);
+	width = (width > 1) ? width : 1;
+	PRINTF(("%s %-*s ", value, width, unit));
 }
 
 /*
- * prints a 12 hour time given a pointer to a time of day
+ * prints a locale-specific time given a pointer to a time of day
  */
 static void
 prtat(time_t *time)
@@ -675,23 +688,22 @@
 	p = localtime(time);
 	if (now - *time <= 18 * HR) {
 		char timestr[50];
+
 		(void) strftime(timestr, sizeof (timestr),
-		    dcgettext(NULL, "%l:%M""%p", LC_TIME), p);
-		checkampm(timestr);
-		PRINTF((" %s", timestr));
+		    "%X", p);
+		PRINTF(("%-11s ", timestr));
 	} else if (now - *time <= 7 * DAY) {
 		char weekdaytime[20];
 
 		(void) strftime(weekdaytime, sizeof (weekdaytime),
-		    dcgettext(NULL, "%a%l%p", LC_TIME), p);
-		checkampm(weekdaytime);
-		PRINTF((" %s", weekdaytime));
+		    "%d %b", p);
+		PRINTF(("%-11s ", weekdaytime));
 	} else {
 		char monthtime[20];
 
 		(void) strftime(monthtime, sizeof (monthtime),
-		    dcgettext(NULL, "%e%b%y", LC_TIME), p);
-		PRINTF((" %s", monthtime));
+		    "%b %Y", p);
+		PRINTF(("%-11s ", monthtime));
 	}
 }
 
@@ -738,15 +750,3 @@
 		}
 	}
 }
-
-/* replaces all occurences of AM/PM with am/pm */
-static void
-checkampm(char *str)
-{
-	char *ampm;
-	while ((ampm = strstr(str, "AM")) != NULL ||
-	    (ampm = strstr(str, "PM")) != NULL) {
-		*ampm = tolower(*ampm);
-		*(ampm+1) = tolower(*(ampm+1));
-	}
-}
--- old/usr/src/cmd/whodo/whodo.c	Sat Nov 30 09:38:52 2013
+++ new/usr/src/cmd/whodo/whodo.c	Sat Nov 30 09:38:52 2013
@@ -77,7 +77,7 @@
 
 /* Print minimum field widths. */
 #define	LOGIN_WIDTH	8
-#define	LINE_WIDTH	12
+#define	LINE_WIDTH	8
 
 #define	DIV60(t)	((t+30)/60)    /* x/60 rounded */
 
@@ -133,9 +133,8 @@
 static void	showtotals(struct uproc *);
 static void	calctotals(struct uproc *);
 static char	*getty(dev_t);
-static void	prttime(time_t, char *);
+static void	prttime(time_t, int);
 static void	prtat(time_t *);
-static void	checkampm(char *);
 
 static char	*prog;
 static int	header = 1;	/* true if -h flag: don't print heading */
@@ -282,8 +281,9 @@
 			ut = utmpbegin; /* rewind utmp data */
 			(void) printf(dcgettext(NULL,
 			    "  %d user(s)\n", LC_TIME), nusers);
-			(void) printf(dcgettext(NULL, "User     tty           "
-			    "login@  idle   JCPU   PCPU  what\n", LC_TIME));
+			(void) printf(dcgettext(NULL, "User     tty      "
+			    "login@      idle    JCPU    PCPU    what\n",
+			    LC_TIME));
 		} else {	/* standard whodo header */
 			char date_buf[100];
 
@@ -291,7 +291,7 @@
 			 * print current time and date
 			 */
 			(void) strftime(date_buf, sizeof (date_buf),
-			    dcgettext(NULL, "%C", LC_TIME), localtime(&now));
+			    "%c", localtime(&now));
 			(void) printf("%s\n", date_buf);
 
 			/*
@@ -474,7 +474,7 @@
 			    ut->ut_name);
 
 			/* print tty user is on */
-			(void) printf("%-*.*s", LINE_WIDTH, (int)LMAX,
+			(void) printf("%-*.*s ", LINE_WIDTH, (int)LMAX,
 			    ut->ut_line);
 
 			/* print when the user logged in */
@@ -483,11 +483,7 @@
 
 			/* print idle time */
 			idle = findidle(ut->ut_line);
-			if (idle >= 36 * 60)
-				(void) printf(dcgettext(NULL, "%2ddays ",
-				    LC_TIME), (idle + 12 * 60) / (24 * 60));
-			else
-				prttime(idle, " ");
+			prttime(idle, 8);
 			showtotals(findhash((pid_t)ut->ut_pid));
 		} else {	/* standard whodo format */
 			tim = ut->ut_xtime;
@@ -562,14 +558,14 @@
 
 	/* print CPU time for all processes & children */
 	/* and need to convert clock ticks to seconds first */
-	prttime((time_t)jobtime, " ");
+	prttime((time_t)jobtime, 8);
 
 	/* print cpu time for interesting process */
 	/* and need to convert clock ticks to seconds first */
-	prttime((time_t)proctime, " ");
+	prttime((time_t)proctime, 8);
 
 	/* what user is doing, current process */
-	(void) printf(" %-.32s\n", doing);
+	(void) printf("%-.32s\n", doing);
 }
 
 /*
@@ -738,52 +734,67 @@
 #define	MON	(30 * DAY)
 
 /*
- * prints a time in hours and minutes or minutes and seconds.
- * The character string 'tail' is printed at the end, obvious
- * strings to pass are "", " ", or "am".
+ * prttime prints a time in days, hours, minutes, or seconds.
+ * The second argument is the field width.
  */
 static void
-prttime(time_t tim, char *tail)
+prttime(time_t tim, int width)
 {
-	if (tim >= 60)
-		(void) printf(dcgettext(NULL, "%3d:%02d", LC_TIME),
-		    (int)tim/60, (int)tim%60);
-	else if (tim > 0)
-		(void) printf(dcgettext(NULL, "    %2d", LC_TIME), (int)tim);
-	else
-		(void) printf("      ");
-	(void) printf("%s", tail);
+	char value[12];
+	char *unit;
+
+	if (tim >= 36 * HR) {
+		(void) snprintf(value, sizeof (value), "%d",
+		    (tim + (DAY / 2)) / (DAY));
+		unit = dcgettext(NULL, "days", LC_TIME);
+	} else if (tim >= 36 * 60) {
+		(void) snprintf(value, sizeof (value), "%d",
+		    (tim + (HR / 2)) / (HR));
+		unit = dcgettext(NULL, "hours", LC_TIME);
+	} else if (tim >= 60) {
+		(void) snprintf(value, sizeof (value), "%d",
+		    (tim + 30) / 60);
+		unit = dcgettext(NULL, "mins", LC_TIME);
+	} else if (tim > 0) {
+		(void) snprintf(value, sizeof (value), "%d", (int)tim);
+		unit = dcgettext(NULL, "secs", LC_TIME);
+	} else {
+		(void) strcpy(value, "0");
+		unit = " ";
+	}
+	width -= 2 + strlen(value);
+	width = (width > 1) ? width : 1;
+	printf("%s %-*s ", value, width, unit);
 }
 
 
 /*
- * prints a 12 hour time given a pointer to a time of day
+ * prints a locale-specific time given a pointer to a time of day
  */
 static void
 prtat(time_t *time)
 {
-	struct tm *p;
+	struct tm	*p;
 
 	p = localtime(time);
 	if (now - *time <= 18 * HR) {
 		char timestr[50];
+
 		(void) strftime(timestr, sizeof (timestr),
-		    dcgettext(NULL, " %l:%M""%p", LC_TIME), p);
-		checkampm(timestr);
-		(void) printf("%s", timestr);
+		    "%X", p);
+		printf("%-11s ", timestr);
 	} else if (now - *time <= 7 * DAY) {
 		char weekdaytime[20];
 
 		(void) strftime(weekdaytime, sizeof (weekdaytime),
-		    dcgettext(NULL, "%a%l%p", LC_TIME), p);
-		checkampm(weekdaytime);
-		(void) printf(" %s", weekdaytime);
+		    "%d %b", p);
+		printf("%-11s ", weekdaytime);
 	} else {
 		char monthtime[20];
 
 		(void) strftime(monthtime, sizeof (monthtime),
-		    dcgettext(NULL, "%e%b%y", LC_TIME), p);
-		(void) printf(" %s", monthtime);
+		    "%b %Y", p);
+		printf("%-11s ", monthtime);
 	}
 }
 
@@ -830,15 +841,3 @@
 		}
 	}
 }
-
-/* replaces all occurences of AM/PM with am/pm */
-static void
-checkampm(char *str)
-{
-	char *ampm;
-	while ((ampm = strstr(str, "AM")) != NULL ||
-	    (ampm = strstr(str, "PM")) != NULL) {
-		*ampm = tolower(*ampm);
-		*(ampm+1) = tolower(*(ampm+1));
-	}
-}
