Re: Wakeup/Sleep?
Re: Wakeup/Sleep?
- Subject: Re: Wakeup/Sleep?
- From: Jerry LeVan <email@hidden>
- Date: Wed, 17 Mar 2004 16:06:04 -0500
Here is the latest non working try and the output:
#import <Foundation/Foundation.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int res;
NSDate *now = [NSDate date];
NSDate *plus30Sec = [NSDate dateWithTimeIntervalSinceNow:30];
NSLog(@"\nnow: %@ \nlater: %@", now, plus30Sec);
res = IOPMSchedulePowerEvent ((CFDateRef)plus30Sec,NULL,
CFSTR(kIOPMAutoShutdown));
NSLog(@"res=%x",res);
[pool release];
return 0;
}
running as root gives on the console
[macjerry:~/cocoaprogs/DateStuff/build]$ sudo DateStuff
Password:
2004-03-17 16:02:24.990 DateStuff[2141]
now: <CFDate 0x500fb0 [0xa01900e0]>{time = 101250145}
later: <CFDate 0x503100 [0xa01900e0]>{time = 101250175}
2004-03-17 16:02:24.991 DateStuff[2141] res=e00002d8 <---Always
this error code
[macjerry:~/cocoaprogs/DateStuff/build]$
On Mar 17, 2004, at 3:58 PM, Nicko van Someren wrote:
On 17 Mar 2004, at 20:52, Jerry LeVan wrote:
It is my understanding that NSCalendarData is a subclass of NSDate...
I also tried
NSCalendarDate *now = [NSCalendarDate calendarDate];
NSDate *plus30Sec = [now dateByAddingYears:0 months:0
days:0 hours:0 minutes:0 seconds:30];
using an NSDate got the same error code...
OK, well I guess that wasn't the problem then!
Nicko
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.