gotosleep icon indicating copy to clipboard operation
gotosleep copied to clipboard

Computer still sleeps after battery depletion

Open johnkary opened this issue 13 years ago • 0 comments

If you set a sleep timer and the battery depletes before the timer reaches 0, the timer will resume when power is restored, and go to sleep when it reaches 0.

  1. Current time is 8:00am
  2. Invoke sleep in 30 minutes: gotosleep 1800
  3. Battery depletes after 10 minutes (8:10am)
  4. Computer is plugged into wall and restored power (10:00am)
  5. Script continues executing and goes into sleep state (10:20am)

This is in error, as the intended sleep time was 8:30am, but due to power loss, sleep state was at 10:20am.

Could fix by storing current UNIX time at instantiation and comparing for accuracy when time to invoke sleep. If invoke sleep time > actual sleep time, do not execute.

johnkary avatar Aug 10 '10 13:08 johnkary