summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'SwifTools/Idle/MacOSXIdleQuerier.cpp')
-rw-r--r--SwifTools/Idle/MacOSXIdleQuerier.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/SwifTools/Idle/MacOSXIdleQuerier.cpp b/SwifTools/Idle/MacOSXIdleQuerier.cpp
index f7d4199..6d6780b 100644
--- a/SwifTools/Idle/MacOSXIdleQuerier.cpp
+++ b/SwifTools/Idle/MacOSXIdleQuerier.cpp
@@ -16,20 +16,20 @@
namespace Swift {
MacOSXIdleQuerier::MacOSXIdleQuerier() : ioService(0) {
- mach_port_t masterPort;
- IOMasterPort(MACH_PORT_NULL, &masterPort);
- ioService = IOServiceGetMatchingService(masterPort, IOServiceMatching("IOHIDSystem"));
- assert(ioService);
+ mach_port_t masterPort;
+ IOMasterPort(MACH_PORT_NULL, &masterPort);
+ ioService = IOServiceGetMatchingService(masterPort, IOServiceMatching("IOHIDSystem"));
+ assert(ioService);
}
int MacOSXIdleQuerier::getIdleTimeSeconds() {
- CFTypeRef property = IORegistryEntryCreateCFProperty(ioService, CFSTR("HIDIdleTime"), kCFAllocatorDefault, 0);
- uint64_t idle = 0;
- bool result = CFNumberGetValue((CFNumberRef)property, kCFNumberSInt64Type, &idle);
- assert(result);
- (void) result;
- CFRelease(property);
- return boost::numeric_cast<int>(idle / 1000000000);
+ CFTypeRef property = IORegistryEntryCreateCFProperty(ioService, CFSTR("HIDIdleTime"), kCFAllocatorDefault, 0);
+ uint64_t idle = 0;
+ bool result = CFNumberGetValue((CFNumberRef)property, kCFNumberSInt64Type, &idle);
+ assert(result);
+ (void) result;
+ CFRelease(property);
+ return boost::numeric_cast<int>(idle / 1000000000);
}
}