From e8fb7ada2d3cde90dc23a0acd8f6f2196406fdc0 Mon Sep 17 00:00:00 2001 From: Nabil Elqatib Date: Tue, 16 Nov 2021 11:25:43 +0100 Subject: [PATCH] Add ProcessInfo.systemUptime implemention --- cocoa-foundation/src/foundation.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cocoa-foundation/src/foundation.rs b/cocoa-foundation/src/foundation.rs index 93e3cd3..80d97ca 100644 --- a/cocoa-foundation/src/foundation.rs +++ b/cocoa-foundation/src/foundation.rs @@ -229,7 +229,12 @@ pub trait NSProcessInfo: Sized { msg_send![class!(NSProcessInfo), processInfo] } + unsafe fn systemUptime(_: Self) -> NSTimeInterval { + msg_send![class!(NSProcessInfo), systemUptime] + } + unsafe fn processName(self) -> id; + unsafe fn uptime(self) -> NSTimeInterval; unsafe fn operatingSystemVersion(self) -> NSOperatingSystemVersion; unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool; } @@ -239,6 +244,10 @@ impl NSProcessInfo for id { msg_send![self, processName] } + unsafe fn uptime(self) -> NSTimeInterval { + msg_send![self, systemUptime] + } + unsafe fn operatingSystemVersion(self) -> NSOperatingSystemVersion { msg_send![self, operatingSystemVersion] }