• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: System Idle Time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Idle Time


  • Subject: Re: System Idle Time
  • From: Evan Schoenberg <email@hidden>
  • Date: Tue, 26 Oct 2004 21:16:29 -0500


On Oct 26, 2004, at 4:31 PM, Mike Paquette wrote:

Hmmmm... Not only is that undocumented SPI, but it's also used incorrectly. The comment about MDD PowerMacs is also wildly misleading.

In what sense is it used incorrectly? And how is the comment about MDD PowerMacs misleading? Not being combative; I honestly would like to understand where you're coming from there.

Think about it. Default C return type with no prototype is... And you cast that to... And suppose the real returned value is in another register...

Sorry, I forgot to include the prototype in my reply:
extern double CGSSecondsSinceLastInputEvent(unsigned long evType);

-Evan

On Oct 26, 2004, at 12:59 PM, Evan Schoenberg wrote:

Here's some GPL code from Adium:

//Returns the current # of seconds the user has been idle
- (double)currentIdleTime
{
double idleTime = CGSSecondsSinceLastInputEvent(-1);

//On MDD Powermacs, the above function will return a large value when the machine is active (-1?).
//Here we check for that value and correctly return a 0 idle time.
if(idleTime >= 18446744000.0) idleTime = 0.0; //18446744073.0

return(idleTime);
}

On Oct 26, 2004, at 1:06 PM, Mike Lewis wrote:

Hello,

How can I get the system idle time in Cocoa? I want to know how long the user has been away from computer. I tried using a timer called EventLoopIdleTimer in Carbon, which works fine, but it only gives me the idle time of my application. I also read something about HIDIdleTime in the archives, but couldn't find any source code examples on how to use it.

Cheers,
Mike

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.com/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: System Idle Time
      • From: Finlay Dobbie <email@hidden>
References: 
 >System Idle Time (From: "Mike Lewis" <email@hidden>)
 >Re: System Idle Time (From: Evan Schoenberg <email@hidden>)
 >Re: System Idle Time (From: Mike Paquette <email@hidden>)

  • Prev by Date: Re: detecting an active Internet connection
  • Next by Date: Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • Previous by thread: Re: System Idle Time
  • Next by thread: Re: System Idle Time
  • Index(es):
    • Date
    • Thread