Created attachment 197476 [details] 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.
Agreed. I will commit this.
A commit references this bug: Author: tmunro Date: Tue Nov 20 00:06:53 UTC 2018 New revision: 340655 URL: https://svnweb.freebsd.org/changeset/base/340655 Log: pom: Fix fencepost bugs. Under some conditions pom would report "waning" and then "full", show higher percentages than it should, and get confused by DST. Fix. Before: 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) After: 2018.01.30: The Moon is Waxing Gibbous (96% of Full) 2018.01.31: The Moon is Waxing Gibbous (99% of Full) 2018.02.01: The Moon is Full 2018.02.02: The Moon is Waning Gibbous (97% of Full) PR: 231705 Submitted by: Andrew Gierth Approved by: allanjude (mentor) MFC after: 2 weeks Differential Revision: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231705 Changes: head/usr.bin/pom/pom.c
A commit references this bug: Author: tmunro Date: Sun Jul 12 10:07:01 UTC 2020 New revision: 363126 URL: https://svnweb.freebsd.org/changeset/base/363126 Log: MFC r340655 pom: Fix fencepost bugs. PR: 231705 Submitted by: Andrew Gierth <andrew@tao11.riddles.org.uk> Approved by: allanjude (mentor) Changes: _U stable/12/ stable/12/usr.bin/pom/pom.c