I’m trying to detect the last instance that a user interacted with a given Mac (preferably in some sort of comparable data structure, like seconds since the epoch.)
This interaction should include typing, mouse motion, app interaction, etc. However, I am not looking to determine whether or not the computer is locked or on screen-save, because those states are subject to user preference.
You can get the number of seconds since the last event using this function:
This returns a
CFTimeIntervalwhich is adouble.