Subject: bin/36831: rtclocaltime shows negative 0
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <zafer@aydogan.de>
List: netbsd-bugs
Date: 08/24/2007 16:50:01
>Number:         36831
>Category:       bin
>Synopsis:       rtclocaltime shows negative 0
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 24 16:50:00 +0000 2007
>Originator:     Zafer Aydogan
>Release:        4.99.29
>Organization:
>Environment:
i386
>Description:
when using rtclocaltime=no in rc.conf and when /etc/localtime links to UTC (default), then rc.d prints during boot:

Setting RTC offset to -0.

Commonly it is said that a number is non-negative if and only if it is greater than or equal to zero.
The patch fixes this. No functional changes, just cosmetics showing 0 without a negative sign.

 
>How-To-Repeat:

>Fix:
--- rtclocaltime.orig   2007-08-24 16:29:42.000000000 +0000
+++ rtclocaltime        2007-08-24 16:30:10.000000000 +0000
@@ -18,7 +18,7 @@
 {
        rtcoff=$(date '+%z' | awk '{
                offset = int($1);
-               if (offset < 0) {
+               if (offset <= 0) {
                        sign = -1;
                        offset = -offset;
                } else {