NSProcessInfo: implement getting system uptime

Introduce the systemUptime property to NSProcessInfo, which can compute
platform-independently what is the uptime of the system.
This commit is contained in:
Daniel Ferreira 2017-06-21 09:59:31 +10:00 committed by Ivan Vučica
parent 277ae581a6
commit cbfa4d8cc9
3 changed files with 51 additions and 0 deletions

View file

@ -39,8 +39,14 @@ int main()
PASS((obj != nil && [obj isKindOfClass:[NSString class]] && [obj length] > 0),
"-operatingSystemName works");
NSLog(@"operatingSystemName %@", obj);
val = [info operatingSystem];
PASS(val != 0, "-operatingSystem works");
val = [info systemUptime];
NSLog(@"systemUptime %lu", val);
PASS(val != 0, "-systemUptime works");
obj = [info hostName];
PASS((obj != nil && [obj isKindOfClass:[NSString class]] && [obj length] > 0),
"-hostName works");