First of all, polling is inferiour to notifications because it wastes system resources that could instead be spent on useful work (and your current loop is a busy loop, too). Naturally, power management event systems are OS-specific (see Power Management Notifications in Linux and how to hook to events / messages in windows using python) but if you're writing a system monitor app, you can't hide from OS differences anyway.
Now, the key here is to always have two timestamps in memory and overwrite the older one:
T1
\
T2
<- compare
/
T3
<- compare
\
T4
etc
/
Then, at whichever moment a suspend happens, the next timestamp will be set later than it should, and the comparison will see the difference.
This way, you don't even need to poll every second or so! Your poll interval needs to be only as short as is the shortest suspend period that you'd like to detect. E.g. if you'd like to detect at least a 30s suspend period, you only have to poll every 30s: if the system sleeps for longer, it will be guaranteed to "miss a beat".
i=0
poll_period=30
t=[time.time()]*2
while True:
# actually, poll period will be slightly longer due to code overhead:
# https://stackoverflow.com/questions/26774186/looping-at-a-constant-rate-with-high-precision-for-signal-sampling
# but that doesn't make a difference in this case
time.sleep(poll_period)
t[i]=time.time()
if t[i] - t[(i+1)%2] > poll_period + 2: print "suspend detected"
i = (i+1)%2
Note that you will get false positives if your process gets preempted by others. That's yet another reason why using system notifications is a vastly superior way.