Bug 12614

Summary: [patch] apm -r doesn't respect wall_cmos_clock
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 02:00:01 UTC
    apm -r sets the machine to wake up from suspend mode after the specified
    number of seconds.  However, it always calculates the time to wake up in
    UTC, even if the machine's CMOS clock uses wall time.  The effect is that
    apm -r will wake up your machine either several hours too late (if you're
    west of Greenwich) or not at all (if you're east).
 
    /usr/src/usr.sbin/apm/apm.c includes code to correctly set the wakeup
    time on wall_cmos_clock machines, controlled by the variable "cmos_wall".
    It never actually sets that variable, though, so it always uses the code
    path for UTC CMOS clock machines.  I've included a patch for apm below.

Fix: The following patch fixes the problem.

    Note: when testing apm (with or without this patch), do not trust the
    "Resume timer:" line it sometimes outputs.  That's also broken, and I've
    submitted a patch for it as a separate PR.

How-To-Repeat: 
    $ ls -l /etc/wall_cmos_clock
    -rw-r--r--  1 root  wheel  0 Jun 19 19:45 /etc/wall_cmos_clock
    $ apm
    APM version: 1.2
    APM Managment: Enabled
    AC Line status: on-line
    Battery status: charging
    Remaining battery life: 92%
    Remaining battery time: unknown
    Number of batteries: 2
    Resume timer: disabled
    Resume on ring indicator: disabled
    APM Capacities:
	    global standby state
	    global suspend state
	    resume timer from suspend
    $ apm -r30
    $ zzz

    The machine suspends, but does not resume 30 seconds later.
Comment 1 Mitsuru IWASAKI freebsd_committer freebsd_triage 1999-07-29 20:22:12 UTC
State Changed
From-To: open->closed

Fixed in CURRENT and RELENG_3.  Thanks!