Print this page
2849 uptime should use locale settings for current time

@@ -127,11 +127,10 @@
 static void     clnarglist(char *);
 static void     showtotals(struct uproc *);
 static void     calctotals(struct uproc *);
 static void     prttime(time_t, char *);
 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 */
 static int      lflag = 1;      /* set if -l flag; 0 for -s flag: short form */
 static char     *sel_user;      /* login of particular user selected */

@@ -674,25 +673,23 @@
 
         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);
+                    " %R  ", p);
                 PRINTF((" %s", 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);
+                    "%a%H  ", p);
                 PRINTF((" %s", weekdaytime));
         } else {
                 char monthtime[20];
 
                 (void) strftime(monthtime, sizeof (monthtime),
-                    dcgettext(NULL, "%e%b%y", LC_TIME), p);
+                    "%e%b%y", p);
                 PRINTF((" %s", monthtime));
         }
 }
 
 /*

@@ -736,17 +733,5 @@
                         }
                         *c = '?';
                 }
         }
 }
-
-/* 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));
-        }
-}