Re: Setting time to 24 hour format
On Mon, Mar 19, 2001 at 10:27:34AM -0600, Bryan Walton wrote:
> Does anybody know how I can set my clock so that when I type "uptime" the
> time will be shown in 24 hour time rather than as below:
>
> walton@work:~$ uptime
> 10:25am up 4 days, 1:32, 6 users, load average: 0.06, 0.07, 0.08
I don't think there is a way to achieve this without editing the source.
uptime is neither locale aware, nor does it have a command line option
for this.
A quick look at the source reveals that the output format is hardcoded...
The relevant fragment from whattime.c (called from uptime.c -- in the
"procps" pkg):
pos = sprintf(buf, " %2d:%02d%s ",
realtime->tm_hour%12 ? realtime->tm_hour%12 : 12,
realtime->tm_min, realtime->tm_hour > 11 ? "pm" : "am");
I guess you'd have to change this, if the 12 hour mode really bothers
you badly enough ;)
Erdmut
--
Erdmut Pfeifer
science+computing ag
-- Bugs come in through open windows. Keep Windows shut! --
Reply to: