summaryrefslogtreecommitdiff
path: root/apps/graphics/traveler/src/trv_main.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-12-08 12:39:02 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-12-08 12:39:02 -0600
commit2cf33eff014e7de2dab04d15159c75a976f337f9 (patch)
tree2df7307ba6e1d04d777485e9fa5b7ca635f10edd /apps/graphics/traveler/src/trv_main.c
parent8b9a789357596d976105ad1e73d369ddfd189683 (diff)
downloadnuttx-2cf33eff014e7de2dab04d15159c75a976f337f9.tar.gz
nuttx-2cf33eff014e7de2dab04d15159c75a976f337f9.tar.bz2
nuttx-2cf33eff014e7de2dab04d15159c75a976f337f9.zip
Travel: Fix more initialization errors, mostly related to file path problems
Diffstat (limited to 'apps/graphics/traveler/src/trv_main.c')
-rw-r--r--apps/graphics/traveler/src/trv_main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/graphics/traveler/src/trv_main.c b/apps/graphics/traveler/src/trv_main.c
index 078a5aef9..53cc1cca8 100644
--- a/apps/graphics/traveler/src/trv_main.c
+++ b/apps/graphics/traveler/src/trv_main.c
@@ -169,7 +169,6 @@ int traveler_main(int argc, char *argv[])
FAR const char *wldfile;
#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON
int32_t frame_count = 0;
- double elapsed_time = 0.0;
double start_time;
#endif
int ret;
@@ -265,14 +264,20 @@ int traveler_main(int argc, char *argv[])
/* Display the world. */
trv_display_update(&g_trv_ginfo);
+
#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON
+ /* Show the frame rate */
+
frame_count++;
- elapsed_time += trv_current_time() - start_time;
if (frame_count == 100)
{
- fprintf(stderr, "fps = %3.2f\n", (double) frame_count / elapsed_time);
+ double now = trv_current_time();
+ double elapsed = now - start_time;
+
+ fprintf(stderr, "fps = %3.2f\n", (double)frame_count / elapsed);
+
frame_count = 0;
- elapsed_time = 0.0;
+ start_time = now;
}
#endif
}