GNU bug report logs -
#26783
Discrepancy with uptime added as part of "[PATCH] Document uptime."
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26783 in the body.
You can then email your comments to 26783 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#26783
; Package
coreutils
.
(Fri, 05 May 2017 06:05:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Prateek saxena <prateeksaxena2 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 05 May 2017 06:05:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
We found some discrepancy with uptime utility of coreutils package.
In my system using coreutils package with version 8.26, uptime output prints
PM/AM for 24 hour time format.
Logs:
------------------------------------------------------------------------------------
# uptime
17:19pm up 6 days 10:02, 1 user, load average: 0.18, 0.14, 0.10
# uptime --version
uptime (GNU coreutils) 8.26
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi
------------------------------------------------------------------------------------
The time is in 24 hours format and PM is not expected to be printed.
We can see latest patch for uptime utility, use of fprintftime to print the
time
(http://lists.gnu.org/archive/html/bug-coreutils/2008-08/msg00035.html).
------------------------------------------------------------------------------------
diff --git a/src/uptime.c b/src/uptime.c
index 9e3384f..5bdc230 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -36,6 +36,7 @@
#include "long-options.h"
#include "quote.h"
#include "readutmp.h"
+#include "fprintftime.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "uptime"
@@ -126,12 +127,10 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
uphours = (uptime - (updays * 86400)) / 3600;
upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60;
tmn = localtime (&time_now);
+ /* procps' version of uptime also prints the seconds field, but
+ previous versions of coreutils don't. */
if (tmn)
- printf (_(" %2d:%02d%s up "),
- ((tmn->tm_hour % 12) == 0 ? 12 : tmn->tm_hour % 12),
- /* FIXME: use strftime, not am, pm. Uli reports that
- the german translation is meaningless. */
- tmn->tm_min, (tmn->tm_hour < 12 ? _("am") : _("pm")));
+ fprintftime (stdout, _(" %H:%M%P up "), tmn, 0, 0);
else
printf (_(" ??:???? up "));
if (uptime == (time_t) -1)
-----------------------------------------------------------------------------------
Can you please verify whether PM/AM should be avoided from uptime print.
Please find attach patch to remove AM/PM from the print for your reference.
Please provide your inputs for same.
Thanks & Regards,
Prateek
[Message part 2 (text/html, inline)]
[0001-uptime_am_pm_print_remove.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#26783
; Package
coreutils
.
(Fri, 05 May 2017 20:20:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 26783 <at> debbugs.gnu.org (full text, mbox):
On 04/05/17 23:03, Prateek saxena wrote:
> Hi,
>
> We found some discrepancy with uptime utility of coreutils package.
>
> In my system using coreutils package with version 8.26, uptime output prints
> PM/AM for 24 hour time format.
>
> Logs:
> ------------------------------------------------------------------------------------
> # uptime
> 17:19pm up 6 days 10:02, 1 user, load average: 0.18, 0.14, 0.10
>
> # uptime --version
> uptime (GNU coreutils) 8.26
> Copyright (C) 2016 Free Software Foundation, Inc.
>
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>> .
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Written by Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi
> ------------------------------------------------------------------------------------
>
> The time is in 24 hours format and PM is not expected to be printed.
> We can see latest patch for uptime utility, use of fprintftime to print the
> time
> (http://lists.gnu.org/archive/html/bug-coreutils/2008-08/msg00035.html).
>
> ------------------------------------------------------------------------------------
> diff --git a/src/uptime.c b/src/uptime.c
> index 9e3384f..5bdc230 100644
> --- a/src/uptime.c
> +++ b/src/uptime.c
> @@ -36,6 +36,7 @@
> #include "long-options.h"
> #include "quote.h"
> #include "readutmp.h"
> +#include "fprintftime.h"
>
> /* The official name of this program (e.g., no `g' prefix). */
> #define PROGRAM_NAME "uptime"
> @@ -126,12 +127,10 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
> uphours = (uptime - (updays * 86400)) / 3600;
> upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60;
> tmn = localtime (&time_now);
> + /* procps' version of uptime also prints the seconds field, but
> + previous versions of coreutils don't. */
> if (tmn)
> - printf (_(" %2d:%02d%s up "),
> - ((tmn->tm_hour % 12) == 0 ? 12 : tmn->tm_hour % 12),
> - /* FIXME: use strftime, not am, pm. Uli reports that
> - the german translation is meaningless. */
> - tmn->tm_min, (tmn->tm_hour < 12 ? _("am") : _("pm")));
> + fprintftime (stdout, _(" %H:%M%P up "), tmn, 0, 0);
> else
> printf (_(" ??:???? up "));
> if (uptime == (time_t) -1)
> -----------------------------------------------------------------------------------
>
> Can you please verify whether PM/AM should be avoided from uptime print.
>
> Please find attach patch to remove AM/PM from the print for your reference.
>
> Please provide your inputs for same.
>
> Thanks & Regards,
> Prateek
>
Nice catch.
I'm happy to simplify and switch to 24 hour
(which also matches procps-ng normally used on Linux)
thanks
Pádraig
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#26783
; Package
coreutils
.
(Thu, 11 May 2017 05:41:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 26783 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Pádraig,
Thanks for replying.
When we can expect the fix.
Can we use the attached patch as workaround for time been. whether it
would be sufficient.
Thanks & Regards,
Prateek
On Sat, May 6, 2017 at 1:48 AM, Pádraig Brady <P <at> draigbrady.com> wrote:
> On 04/05/17 23:03, Prateek saxena wrote:
>> Hi,
>>
>> We found some discrepancy with uptime utility of coreutils package.
>>
>> In my system using coreutils package with version 8.26, uptime output prints
>> PM/AM for 24 hour time format.
>>
>> Logs:
>> ------------------------------------------------------------------------------------
>> # uptime
>> 17:19pm up 6 days 10:02, 1 user, load average: 0.18, 0.14, 0.10
>>
>> # uptime --version
>> uptime (GNU coreutils) 8.26
>> Copyright (C) 2016 Free Software Foundation, Inc.
>>
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>>> .
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
>> Written by Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi
>> ------------------------------------------------------------------------------------
>>
>> The time is in 24 hours format and PM is not expected to be printed.
>> We can see latest patch for uptime utility, use of fprintftime to print the
>> time
>> (http://lists.gnu.org/archive/html/bug-coreutils/2008-08/msg00035.html).
>>
>> ------------------------------------------------------------------------------------
>> diff --git a/src/uptime.c b/src/uptime.c
>> index 9e3384f..5bdc230 100644
>> --- a/src/uptime.c
>> +++ b/src/uptime.c
>> @@ -36,6 +36,7 @@
>> #include "long-options.h"
>> #include "quote.h"
>> #include "readutmp.h"
>> +#include "fprintftime.h"
>>
>> /* The official name of this program (e.g., no `g' prefix). */
>> #define PROGRAM_NAME "uptime"
>> @@ -126,12 +127,10 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
>> uphours = (uptime - (updays * 86400)) / 3600;
>> upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60;
>> tmn = localtime (&time_now);
>> + /* procps' version of uptime also prints the seconds field, but
>> + previous versions of coreutils don't. */
>> if (tmn)
>> - printf (_(" %2d:%02d%s up "),
>> - ((tmn->tm_hour % 12) == 0 ? 12 : tmn->tm_hour % 12),
>> - /* FIXME: use strftime, not am, pm. Uli reports that
>> - the german translation is meaningless. */
>> - tmn->tm_min, (tmn->tm_hour < 12 ? _("am") : _("pm")));
>> + fprintftime (stdout, _(" %H:%M%P up "), tmn, 0, 0);
>> else
>> printf (_(" ??:???? up "));
>> if (uptime == (time_t) -1)
>> -----------------------------------------------------------------------------------
>>
>> Can you please verify whether PM/AM should be avoided from uptime print.
>>
>> Please find attach patch to remove AM/PM from the print for your reference.
>>
>> Please provide your inputs for same.
>>
>> Thanks & Regards,
>> Prateek
>>
>
>
> Nice catch.
> I'm happy to simplify and switch to 24 hour
> (which also matches procps-ng normally used on Linux)
>
> thanks
> Pádraig
[0001-uptime_am_pm_print_remove.patch (application/octet-stream, attachment)]
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Thu, 11 May 2017 11:57:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Prateek saxena <prateeksaxena2 <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 11 May 2017 11:57:03 GMT)
Full text and
rfc822 format available.
Message #16 received at 26783-done <at> debbugs.gnu.org (full text, mbox):
On 11/05/17 06:40, Prateek saxena wrote:
> Hi Pádraig,
>
> Thanks for replying.
>
> When we can expect the fix.
>
> Can we use the attached patch as workaround for time been. whether it
> would be sufficient.
Your patch is now applied at:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.27-35-g82911c5
and will be made available in the next release.
thanks,
Pádraig
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#26783
; Package
coreutils
.
(Fri, 12 May 2017 10:55:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 26783-done <at> debbugs.gnu.org (full text, mbox):
Thanks Pádraig !!
Regards,
Prateek
On Thu, May 11, 2017 at 5:26 PM, Pádraig Brady <P <at> draigbrady.com> wrote:
> On 11/05/17 06:40, Prateek saxena wrote:
>> Hi Pádraig,
>>
>> Thanks for replying.
>>
>> When we can expect the fix.
>>
>> Can we use the attached patch as workaround for time been. whether it
>> would be sufficient.
>
> Your patch is now applied at:
> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.27-35-g82911c5
> and will be made available in the next release.
>
> thanks,
> Pádraig
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 09 Jun 2017 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 104 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.