Timer based action if imp is disconnected

I want to keep an eye on the imp, and would really like to know what the recommended method of keeping an eye on the imp.

I am setting a timestamp in my agent code every time the imp sends some data, which I want to check after 30 minutes, and if nothing has been sent, I can assume that the imp has run out of batteries.

But how do I do that in the agent code?