I have an app running in Mac that stops working when it sleeps (Forced sleep or by its own). Mine is a time-based-app and I need to fill up the time programmatically for the time the OS went to sleep. So in order to do so I need to know when did the computer went to sleep and when did it woke up to make corresponding changes in the database. So how will I know programmatically if the system went to sleep?
And btw my app runs in Java.