LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-27-2008, 09:02 PM   #1
km4hr
Member
 
Registered: Aug 2003
Posts: 39

Rep: Reputation: 15
Is there an API to determine when computer is sleeping?


I want to write a C program that runs in the background and records the amount of time that my computer is sleeping, that is, not being used. By "sleeping" I mean when the monitor goes black and waiting for user input to wake up. Is there a programming API/routine that can be used to determine when the computer is sleeping? (I want to write the program in C because it's the only language I know.) Is there a another way?
 
Old 04-27-2008, 11:59 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
There's a standard protocol that *enables* your computer to hibernate - ACPI.

You need to determine which combination for ACPI-compliant hardware and software your PC and distro support, and then go from there to see what kinds of statistics you can collect.

My guess is that your system is very likely to support ACPI out of the box, and you're likely to find promising statistics in your /proc filesystem.

Anyway, here are a couple of links to get you started in the right direction:

http://www.linux.com/articles/54610
http://www.linux.org/docs/ldp/howto/...anagement.html

'Hope that helps .. PSM
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i determine my IP address? How do i determine my host name? jwymore Linux - Networking 5 02-07-2007 09:57 AM
How does my computer determine which wireless device to use? drkstr Slackware 9 09-03-2006 03:53 PM
Determine Computer name lel800 Linux - Networking 5 01-26-2004 05:02 PM
Sleeping Nukem Mandriva 6 01-07-2004 05:03 AM
how do you determine the static ip your computer should use jooper317 Linux - Hardware 1 01-06-2004 07:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration