Ubuntu Forums Archive Viewer

C++ Library? (For Idle Time)

Archived thread 1075029 from Ubuntu Dev Link Forum. Markdown source: Ubuntu_Dev_Link_Forum/thread_1075029_C++_Library_(For_Idle_Time).md

Original URL About this archive
#1

Hi,

I was looking for a library to access the idle time of the computer in Ubuntu - defined as: current_time - last_user_input_time.

I trying to develop a small application that uses this. So I was wondering if there was a library out there that has this. If it was for C++ it would be nice. Would anyone know?

I tried googling for the solution and found this thread: http://ubuntuforums.org/showthread.php?t=931676 which led me nowhere.

Please note that I am a university student and I may not be familiar with things.

Thanks a lot for the help.

#2

do you mean you are trying to have a program run in the CPU idle time?

#3

no, i'm just trying to get the idle time - get some primitive of the idle time returned from a function.

#4

I think you're going to have to look more into system calls, than C++ libraries.

Well you could have a program listen for inputs from the mouse and keyboard and then update a marker every time that happens, and then just spin around the loop the rest of the time, but as far as just pulling out of thin air the last time input was raised, that might be impossible.

This woudl be kinda intense kernel work.

#5

oh..... thought it would be easier than that haha. i'm doing my operating systems course right now, so i guess i'll stop from here.

thanks for the help.