Log in time

I'm trying to make a program that counts the amount of time you spend on a computer. I want to see how much time I really spend on a computer. Please help me out.
Have the program start when the system boots and log the time of boot. Have the program write the current date and time to a file once in a while. When the system starts for the next time, this will be the time of shutdown.

If you don't want to count periods of time where you're not doing anything on the computer, periodically check how long the system has been idle and subtract that from the usage time. On Windows, you can use GetLastInputInfo and on Linux and other X systems you can use XScreenSaverQueryInfo.
Topic archived. No new replies allowed.