本帖最后由 unique009 于 2012-11-27 15:24 编辑
这是源代码script_misc.cpp:
///////////////////////////////////////////////////////////////////////////////
// TimerInit()
// Returns a floating point value that is a baseline system time.
// Starts tracking a high performance counter allowing for accurate timers.
///////////////////////////////////////////////////////////////////////////////
AUT_RESULT AutoIt_Script::F_TimerInit(VectorVariant &vParams, Variant &vResult)
{
__int64 now;
if (!QueryPerformanceCounter((LARGE_INTEGER *)&now))
return AUT_OK;
vResult = (double)now;
return AUT_OK;
} // TimerInit()
///////////////////////////////////////////////////////////////////////////////
// TimerDiff(Baseline)
// Takes the time difference between now and Baseline and returns the result.
///////////////////////////////////////////////////////////////////////////////
AUT_RESULT AutoIt_Script::F_TimerDiff(VectorVariant &vParams, Variant &vResult)
{
__int64 freq, now;
if (!QueryPerformanceFrequency((LARGE_INTEGER *)&freq))
return AUT_OK;
if (!QueryPerformanceCounter((LARGE_INTEGER *)&now))
return AUT_OK;
vResult = (((double)now - vParams[0].fValue()) / (double)freq) * 1000.0;
return AUT_OK;
} // TimerDiff()
|