编程技术记录

世界你好!

[[NSProcessInfo processInfo] systemUptime];

或者

#include <mach/mach.h>
#include <mach/mach_time.h>
long long tm = mach_absolute_time();

static mach_timebase_info_data_t    sTimebaseInfo;
    if ( sTimebaseInfo.denom == 0 ) //静态整型变量初始化时默认为0
    {
        mach_timebase_info(&sTimebaseInfo);
    }

    return tm * sTimebaseInfo.numer / sTimebaseInfo.denom  / (1000*1000);

发表回复

© Beli. All Rights Reserved.