修正Time.Delay精度

This commit is contained in:
大石头 2017-03-16 22:58:45 +08:00
parent 52b1f1a313
commit da5c2f0d43
1 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ INROOT void TTime::Delay(int us) const
uint max = UsToTicks(1000 - 1); uint max = UsToTicks(1000 - 1);
if (ticks >= max) if (ticks >= max)
{ {
ms++; end++;
ticks -= max; ticks -= max;
} }
@ -125,7 +125,7 @@ INROOT void TTime::Delay(int us) const
while (true) while (true)
{ {
// 首先比较毫秒数 // 首先比较毫秒数
int n = (int)(Current() - ms); int n = (int)(Current() - end);
if (n > 0) break; if (n > 0) break;
if (n == 0 && CurrentTicks() >= ticks) break; if (n == 0 && CurrentTicks() >= ticks) break;