[Bug 231705] pom(6) incorrect output

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Sep 25 06:24:42 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231705

            Bug ID: 231705
           Summary: pom(6) incorrect output
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: andrew at tao11.riddles.org.uk

Created attachment 197476
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=197476&action=edit
patch for pom(6)

$ TZ=GMT-1; export TZ
$ for d in 2018.01.30 2018.01.31 2018.02.01 2018.02.02; do printf "%s: " "$d";
pom -d $d; done
2018.01.30: The Moon is Waxing Gibbous (97% of Full)
2018.01.31: The Moon is Waning Gibbous (100% of Full)
2018.02.01: The Moon is Full
2018.02.02: The Moon is Waning Gibbous (98% of Full)

Line 2 shows incorrect output of "Waning Gibbous" instead of "Waxing Gibbous",
and 100% instead of the correct 99%. This is caused by the fact that "today"
has had 0.5 added to it before comparing against "tomorrow", which has not.

In addition, rounding means that the displayed percentage is often higher than
the true value: today+0.5 is being rounded, not truncated, to 0 decimals by
%1.0f.

A separate bug causes the computed GMT time to be possibly off by one hour: the
value of tm_isdst from the current time is being kept rather than being set
back to -1 when requesting a specific date or time.

Patch attached.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list