aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-04-15 21:34:51 +0000
committermichux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-04-15 21:34:51 +0000
commit6322058d1e3546f64dca5225549cf2e87d8add33 (patch)
tree4ca1439b9cf676567ad95555dc9516fa43c98f8c
parent2fc3bb1ea3f4530ede6fdd2fda10848cc2c4d9d7 (diff)
downloadlcd4linux-6322058d1e3546f64dca5225549cf2e87d8add33.tar.gz
timer fix for vnc driver
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1031 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_vnc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drv_vnc.c b/drv_vnc.c
index 443cab3..efd788f 100644
--- a/drv_vnc.c
+++ b/drv_vnc.c
@@ -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;