Print this page
2849 uptime should use locale settings for current time
*** 127,137 ****
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 */
--- 127,136 ----
*** 674,698 ****
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));
} 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));
} else {
char monthtime[20];
(void) strftime(monthtime, sizeof (monthtime),
! dcgettext(NULL, "%e%b%y", LC_TIME), p);
PRINTF((" %s", monthtime));
}
}
/*
--- 673,695 ----
p = localtime(time);
if (now - *time <= 18 * HR) {
char timestr[50];
(void) strftime(timestr, sizeof (timestr),
! " %R ", p);
PRINTF((" %s", timestr));
} else if (now - *time <= 7 * DAY) {
char weekdaytime[20];
(void) strftime(weekdaytime, sizeof (weekdaytime),
! "%a%H ", p);
PRINTF((" %s", weekdaytime));
} else {
char monthtime[20];
(void) strftime(monthtime, sizeof (monthtime),
! "%e%b%y", p);
PRINTF((" %s", monthtime));
}
}
/*
*** 736,752 ****
}
*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));
- }
- }
--- 733,737 ----