double shrDelta(int iCounterID = 0){ //this is the 27 the line
double DeltaT;
static struct timeval _NewTime;
static struct timeval _OldTime[3];
gettimeofday(&_NewTime, NULL);
if (iCounterID >= 0 && iCounterID <= 2)
{
DeltaT = ((double)_NewTime.tv_sec + 1.0e-6 * (double)_NewTime.tv_usec) - ((double)_OldTime[iCounterID].tv_sec + 1.0e-6 * (double)_OldTime[iCounterID].tv_usec);
_OldTime[iCounterID].tv_sec = _NewTime.tv_sec;
_OldTime[iCounterID].tv_usec = _NewTime.tv_usec;
}
else
{
DeltaT = -9999.0;
}
return DeltaT;
}
该函数应该返回最后两次调用之间经过的时间。
C不支持函数参数的默认设置(或与此相关的函数重载)。
你需要写
double shrDelta(int iCounterID)
而是始终使用显式给出的参数值来调用该函数。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句