boot_mark update_mark
如果对您有帮助请点个赞
#import
#import
#define MIB_SIZE 2
-(NSString *)getBoot {
NSString *timeString = nil;
int mib[MIB_SIZE];
size_t size;
struct timeval boottime;
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
size = sizeof(boottime);
if (sysctl(mib, MIB_SIZE, &boottime, &size, NULL, 0) != -1) {
timeString = [NSString stringWithFormat:@"%d.%d", (int) boottime.tv_sec, (int) boottime.tv_usec];
}
return timeString?:@"";
}
- (NSString *)getUpdate {
NSString *timeString = nil;
struct stat sb;
NSString *enCodePath = @"L3Zhci9tb2JpbGU=";
NSData *data=[[NSData alloc]initWithBase64EncodedString:enCodePath options:0];
NSString *dataString = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
const char* dePath = [dataString cStringUsingEncoding:NSUTF8StringEncoding];
if (stat(dePath, &sb) != -1) {
timeString = [NSString stringWithFormat:@"%d.%d", (int)sb.st_ctimespec.tv_sec, (int)sb.st_ctimespec.tv_nsec];
} else {
timeString = @"0.0";
}
return timeString?:@"";
}