diff options
Diffstat (limited to 'engines/lab/utils.cpp')
-rw-r--r-- | engines/lab/utils.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/engines/lab/utils.cpp b/engines/lab/utils.cpp index 3adcc954c9..ec69d81f46 100644 --- a/engines/lab/utils.cpp +++ b/engines/lab/utils.cpp @@ -427,78 +427,4 @@ void Utils::setBytesPerRow(int num) { _dataBytesPerRow = num; } -/** - * Adds seconds and microseconds to current time to get a new time. - */ -void Utils::addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros) { - uint32 t = g_system->getMillis(); - *timeSec = (t / 1000) + sec; - *timeMicros = (t % 1000) + micros; - - if (*timeMicros >= ONESECOND) { - (*timeSec)++; - (*timeMicros) -= ONESECOND; - } -} - -/** - * Finds the difference between time1 and time2. If time1 is later than - * time2, returns 0. - */ -void Utils::anyTimeDiff(uint32 sec1, uint32 micros1, uint32 sec2, uint32 micros2, uint32 *diffSecs, uint32 *diffMicros) { - *diffSecs = 0; - *diffMicros = 0; - - if (sec1 > sec2) - return; - else if ((sec1 == sec2) && (micros1 >= micros2)) - return; - - if (micros1 > micros2) { - *diffSecs = sec2 - sec1 - 1; - *diffMicros = (ONESECOND - micros1) + micros2; - } else { - *diffSecs = sec2 - sec1; - *diffMicros = micros2 - micros1; - } -} - -/** - * Finds the difference between the current time, and a future time. Returns - * 0 if the future time is actually before the current time. - */ -void Utils::timeDiff(uint32 sec, uint32 micros, uint32 *diffSec, uint32 *diffMicros) { - uint32 t = g_system->getMillis(); - uint32 curSec = t / 1000; - uint32 curMicros = t % 1000; - - anyTimeDiff(curSec, curMicros, sec, micros, diffSec, diffMicros); -} - -/** -* Waits for Secs seconds and Micros microseconds to pass. -*/ -void Utils::microDelay(uint32 secs, uint32 micros) { - uint32 targetMillis = g_system->getMillis() + secs * 1000 + micros; - while (g_system->getMillis() < targetMillis) - g_system->delayMillis(10); -} - -/** - * Waits for a specified time to occur. - */ -void Utils::waitForTime(uint32 sec, uint32 micros) { - uint32 targetMillis = sec * 1000 + micros; - uint32 t = g_system->getMillis(); - uint32 curSec = t / 1000; - uint32 curMicros = t % 1000; - - if (t >= targetMillis) - return; - - if (curMicros > micros) - microDelay(sec - curSec - 1, (ONESECOND - curMicros) + micros - 1); - else - microDelay(sec - curSec, micros - curMicros - 1); -} } // End of namespace Lab |