Is there a way to detect what the current windows system idle time is ?

I need to know when the computer has had no user interaction for a specified
time.


Thanx