mmm... There're some notifications that are sent/can be registered for in Cocoa which alert the app when the system is preparing to sleep. You could (maybe) write a faceless app that waits for the request to sleep and then cancels it if the time isn't in the right range. the maybe is because it might just be one of those "this is going to happen" things, rather than a delegate method "am I allowed to do this". Not sure.