Allowing Your Schedule to Drift
Mac OS X's ability to schedule hardware power on and wake up is great. However, it does have some limitations. One limitation in particular affected Power Manager's availability field.
When we took the decision to move Power Manager’s power on and wake up capabilities into the trigger structures, we had to accept and overcome a potential problem.
Power Manager does not directly power on or wake up your Mac; this capability is handled by Mac OS X and the Mac’s hardware. Software such as Power Manager, and Apple’s own Energy Saver, have to delegate the task to the underlying operating system.
Mac OS X’s ability to schedule hardware power on and wake up is great. However, it does have some limitations. One limitation in particular affected Power Manager’s availability field.
In modern Macs the System Management Controller (SMC) is responsible for the hardware powering on functionality. The SMC appears to be restricted to scheduling power on and wake up events once every thirty seconds.
Our problem could be summarised as:
“When should Power Manager ask the hardware to power on or wake up?”
Imagine a daily trigger set to trigger at 10am, with an availability field set to power on. When should Power Manager ask the hardware to power on?
If the Mac powers on at 10am, by the time the Mac is up and running, the trigger time will have passed and the trigger will be skipped.
If we decide to schedule the Mac to power on before 10am, in order for the Mac to be ready in time, how long before is required?
The answer to this question can not easily be determined. Different Macs take different amounts of time to start up. If the Mac relies on a server to complete the start up, then the time will be measured in minutes on a congested network.
We decided to invert the problem. We took on the problem within our work, rather than try to finesse the variable SMC.
Power Manager asks the SMC to power on or wake up at the trigger’s time - or as close as possible. We then introduce a concept of drift to date and time triggers.
Drift lets Power Manager’s triggers drift within a specified range. A date and time based trigger will trigger even if the trigger time has passed; as long as the trigger is still within it’s period of acceptable drift.
By default drift is two minutes. That means your Mac can take two minutes to power on or wake up, and still have the appropriate date and time trigger fire.
If your Mac takes longer than two minutes to power on or wake up, you can increase the drift period appropriately.
The ability to allow triggers in Power Manager to drift allows your Mac to power on or wake up when you expect, while providing enough of a buffer for Power Manager to account for any delays. A simple but essential solution.