Comment 15 for bug 1095187

Revision history for this message
newbuntu (dsglass) wrote : Re: Wakeup makes my computer wake up around midnight and not at 6h45 as I asked

Thanks Eric for your help on tracking this down, and posting your fix. I believe that as given, though, setalarm would give the wrong time for people who do have their hardware clocks in local time. Instead, I modified the script as follows:

# Account for hardware clock vs UTC mismatch
hw_offset=$(( $(date -d "$(sudo hwclock)" +%s) - $(date +%s) ))

# Actually set alarm #
echo $(( wake_time - offset*60 + hw_offset )) > /sys/class/rtc/rtc0/wakealarm

I have attached a patch. Apply by running `patch /usr/bin/setalarm setalarm.patch`.

It would be great if folks with their hardware clcok in either utc or local time could test this out. If it works, I'll push the update to the code trunk.