blob: ff3a2621b9f35b75e1df75023a5a8b69c2a310b5 [file] [log] [blame] [raw]
Always use 24-hour time format in w(1) and uptime(1).
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/usr.bin/w/extern.h freebsd-11.1/usr/src/usr.bin/w/extern.h
--- /usr/src/usr.bin/w/extern.h 2017-07-21 07:43:22.000000000 +0800
+++ freebsd-11.1/usr/src/usr.bin/w/extern.h 2019-03-22 14:46:56.816601000 +0800
@@ -30,8 +30,6 @@
* $FreeBSD: releng/11.1/usr.bin/w/extern.h 243183 2012-11-17 16:47:05Z ed $
*/
-extern int use_ampm;
-
struct kinfo_proc;
int pr_attime(time_t *, time_t *);
int pr_idle(time_t);
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/usr.bin/w/pr_time.c freebsd-11.1/usr/src/usr.bin/w/pr_time.c
--- /usr/src/usr.bin/w/pr_time.c 2017-07-21 07:43:22.000000000 +0800
+++ freebsd-11.1/usr/src/usr.bin/w/pr_time.c 2019-03-22 14:46:56.817701000 +0800
@@ -72,12 +72,12 @@
tm.tm_year != tp.tm_year) {
/* The line below does not take DST into consideration */
/* else if (*now / 86400 != *started / 86400) { */
- fmt = use_ampm ? L"%a%I%p" : L"%a%H";
+ fmt = L"%a%H";
}
/* Default is hh:mm{am,pm}. */
else {
- fmt = use_ampm ? L"%l:%M%p" : L"%k:%M";
+ fmt = L"%k:%M";
}
(void)wcsftime(buf, sizeof(buf), fmt, &tp);
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/usr.bin/w/w.c freebsd-11.1/usr/src/usr.bin/w/w.c
--- /usr/src/usr.bin/w/w.c 2017-07-21 07:43:22.000000000 +0800
+++ freebsd-11.1/usr/src/usr.bin/w/w.c 2019-03-22 14:47:45.712068000 +0800
@@ -99,7 +99,6 @@
static int nflag; /* true if -n flag: don't convert addrs */
static int dflag; /* true if -d flag: output debug info */
static int sortidle; /* sort by idle time */
-int use_ampm; /* use AM/PM time */
static int use_comma; /* use comma as floats separator */
static char **sel_users; /* login array of particular users selected */
@@ -143,7 +142,6 @@
char *dot;
(void)setlocale(LC_ALL, "");
- use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
use_comma = (*nl_langinfo(RADIXCHAR) != ',');
argc = xo_parse_args(argc, argv);
@@ -471,7 +469,7 @@
* Print time of day.
*/
if (strftime(buf, sizeof(buf),
- use_ampm ? "%l:%M%p" : "%k:%M", localtime(nowp)) != 0)
+ "%k:%M", localtime(nowp)) != 0)
xo_emit("{:time-of-day/%s} ", buf);
/*
* Print how long system has been up.