24 hour clock format

How do I set the clock so it shows 24 hour clock format in FreeBSD. I have been looking for a solution. But I have not yet found anything.

My problem is this when I run uptime in sh shell.

Code:
uptime
12:04AM  up 22 days, 19:16, 1 user, load averages: 0.00, 0.03, 0.02

I don't use the AM/PM format.

Thanks for the help.
 
I am new to FreeBSD, and if you have installed the GNOME2 desktop, just as root manually configure where you see the time.
 
This computer does not have gnome desktop installed or any graphical software. This is as close to minimal server that I am running.
 
The novelty not hardly any FreeBSD, follow the instructions, probably already know will answer other users.

[ Please try different translation software, this makes no sense -- Mod. ]
 
teo said:
The novelty not hardly any FreeBSD, follow the instructions, probably already know will answer other users.
I can't wait to find out what that means. :) :)
 
Looking the source of uptime in /usr/src/usr.bin/w/w.c (yes, uptime and w are the same binary), I see the line below.

Code:
use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');

You are using a locale that uses a 12-hour clock. To see the difference, run uptime with % LANG=fr_FR.UTF-8 uptime and you will see the 24-hour time format.

You can check your locale with % locale.

Have a look at this post to set your locale.
 
The reason is that ps and uptime/w try to use the AM/PM format. Files containing locales of time in many cases define the presence of AM/PM incorrectly.

I'll try to find a time to make a big patch for all locales that need to be updated and send a bug report with it, but the quick fix is to either patch your favourite locale or make a new one and ideally make a copy of the resulting file in the case of overwriting it during system update.

To fix the locale do cd /usr/share/locale/[your locale]/. Edit the LC_TIME file and remove all characters in lines 42, 43, 58 but do not remove these lines.

For example:
Code:
# locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_ALL=
# uptime
 3:29am  up 13:06, 2 users, load averages: 0.15, 0.14, 0.16
# cd /usr/share/locale/en_GB.UTF-8
# cp LC_TIME LC_TIME.old
# vim LC_TIME
# uptime
 3:29  up 13:06, 2 users, load averages: 0.13, 0.13, 0.15
# diff -u LC_TIME.old LC_TIME
--- LC_TIME.old 2013-11-19 03:27:04.000000000 +0100
+++ LC_TIME     2013-11-19 03:29:04.000000000 +0100
@@ -39,8 +39,8 @@
 %H:%M:%S
 %d/%m/%Y
 %a %e %b %X %Y
-am
-pm
+
+
 %a %e %b %Y %X %Z
 January
 February
@@ -55,4 +55,4 @@
 November
 December
 dm
-%I:%M:%S %p
+
 
Actually I have problems in the installation of applications in the required language ports collection or FreeBSD source code, in the general forum is the issue that are slowly helping.

The installation by package only installs the English-language applications and not in the desired language.
 
Before I start messing with the settings. This is my current configuration and from the looks of it this needs to be set-up properly since it is not.

Code:
# locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

The language needs to be Icelandic rather then Danish. But I live in Denmark, but since I am from Iceland I prefer that setting.

Thanks for the help.
 
@kaktus: you're correct, many locales define am/pm incorrectly.
Code:
tingo@kg-core1$ uname -a
FreeBSD kg-core1.kg4.no 8.4-STABLE FreeBSD 8.4-STABLE #0 r253646: Thu Jul 25 10:12:31 UTC 2013
     root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
tingo@kg-core1$ locale
LANG=en_US.ISO8859-1
LC_CTYPE="en_US.ISO8859-1"
LC_COLLATE="en_US.ISO8859-1"
LC_TIME="en_US.ISO8859-1"
LC_NUMERIC="en_US.ISO8859-1"
LC_MONETARY="en_US.ISO8859-1"
LC_MESSAGES="en_US.ISO8859-1"
LC_ALL=
tingo@kg-core1$ uptime
10:14PM  up 19 days, 23:33, 25 users, load averages: 1.29, 1.26, 1.20
 
Back
Top