Print this page
2849 uptime should use locale settings for current time
@@ -133,11 +133,10 @@
static void showtotals(struct uproc *);
static void calctotals(struct uproc *);
static char *getty(dev_t);
static void prttime(time_t, char *);
static void prtat(time_t *);
-static void checkampm(char *);
static char *prog;
static int header = 1; /* true if -h flag: don't print heading */
static int lflag = 0; /* true if -l flag: w command format */
static char *sel_user; /* login of particular user selected */
@@ -289,11 +288,11 @@
/*
* print current time and date
*/
(void) strftime(date_buf, sizeof (date_buf),
- dcgettext(NULL, "%C", LC_TIME), localtime(&now));
+ "%+", localtime(&now));
(void) printf("%s\n", date_buf);
/*
* print system name
*/
@@ -766,25 +765,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);
(void) 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);
(void) printf(" %s", weekdaytime);
} else {
char monthtime[20];
(void) strftime(monthtime, sizeof (monthtime),
- dcgettext(NULL, "%e%b%y", LC_TIME), p);
+ "%e%b%y", p);
(void) printf(" %s", monthtime);
}
}
/*
@@ -828,17 +825,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));
- }
-}