Skip to content

Commit

Permalink
timer fix for vnc driver
Browse files Browse the repository at this point in the history
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1031 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
  • Loading branch information
michux committed Apr 15, 2009
1 parent 2fc3bb1 commit 6322058
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drv_vnc.c
Expand Up @@ -350,8 +350,18 @@ static void drv_vnc_blit_it(const int row, const int col, const int height, cons
gettimeofday(&blittime, NULL);
int time_since_start =
(blittime.tv_sec - startDriver.tv_sec) * 1000 + (blittime.tv_usec - startDriver.tv_usec) / 1000;

/* if time changed since start of lcd4linux */
if (time_since_start < 0) {
gettimeofday(&startDriver, NULL);
time_since_start =
(blittime.tv_sec - startDriver.tv_sec) * 1000 + (blittime.tv_usec - startDriver.tv_usec) / 1000;
if (time_since_start == 0)
time_since_start = 1;
}
//info("time :%d, frames: %d, sleep: %d", time_since_start, frames, sleep);

int fps = (int) (1000 * frames / time_since_start);
//info("time :%d, frames: %d, fps: %d, sleep: %d", time_since_start, frames, fps, sleep);

if (fps > maxfps) {
sleep += SLEEP_STEPS;
Expand Down

0 comments on commit 6322058

Please sign in to comment.