Bug 12613

Summary: [patch] apm reports wrong resume time
Product: Base System Reporter: Michael Constant <mconst>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Michael Constant 1999-07-13 01:50:00 UTC
    (This is a different apm problem than the one I sent out a patch for
    a few minutes ago.)  After using "apm -r" to set a resume timer, you
    can view the timer by running apm.  However, the time apm reports is
    often wrong -- a bug in apm's bcd2int function causes incorrect output
    when any time or date fields have trailing zeros, and an incompletely
    initialized struct tm sometimes causes the hour to be off by one.

Fix: The following patch fixes both problems, and also makes the bcd2int
    routine look much more like the (correct) int2bcd routine.

How-To-Repeat: 
    This is most easily noticed as a year 2000 problem, since all dates in
    2000 will trigger the bug:

    $ apm -r20000000
    $ apm
    APM version: 1.2
    APM Managment: Enabled
    AC Line status: on-line
    Battery status: high
    Remaining battery life: 100%
    Remaining battery time: unknown
    Number of batteries: 2
    Resume timer: Wed Dec 31 15:59:59 1969	<==== that's not right!
    Resume on ring indicator: disabled
    APM Capacities:
	    global standby state
	    global suspend state
	    resume timer from suspend
Comment 1 Nick Hibma freebsd_committer freebsd_triage 1999-07-24 18:05:37 UTC
State Changed
From-To: open->closed

Patch applied in rev. 1.16 of  src/usr.sbin/apm/apm.c by green@freebsd.org 
Thanks!