Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/infowidget.cc')
-rw-r--r--src/client/infowidget.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/client/infowidget.cc b/src/client/infowidget.cc
index 52af5ef..752c09b 100644
--- a/src/client/infowidget.cc
+++ b/src/client/infowidget.cc
@@ -104,16 +104,19 @@ StatsInfoWidget::StatsInfoWidget(ui::Widget *parent) : ui::Widget(parent)
void StatsInfoWidget::draw()
{
// average fps
- fps_counter_time[fps_counter_index] = core::application()->time();
+ unsigned long fps = 0.0f;
+ const unsigned long now = core::application()->timestamp();
+ fps_counter_time[fps_counter_index] = now;
fps_counter_index = (fps_counter_index + 1) % fps_counter_size;
- float min_time = core::application()->time();
+
+ unsigned long min_time = now;
for (size_t i = 0; i < fps_counter_size; i++)
if (fps_counter_time[i] < min_time)
min_time = fps_counter_time[i];
- float fps = 0.0f;
- float t = (core::application()->time() - min_time);
+
+ const unsigned long t = now - min_time;
if (t > 0) {
- fps = roundf(((float) fps_counter_size ) / t);
+ fps = (fps_counter_size - 1) * 1000 / t;
}
std::ostringstream textstream;
@@ -133,13 +136,13 @@ void StatsInfoWidget::draw()
if (core::Stats::network_bytes_sent + core::Stats::network_bytes_received) {
net_counter_traffic[net_counter_index] = core::Stats::network_bytes_sent + core::Stats::network_bytes_received;
- net_counter_time[net_counter_index] = core::application()->time();
+ net_counter_time[net_counter_index] = core::application()->timestamp();
size_t index_max = net_counter_index;
net_counter_index = (net_counter_index + 1) % net_counter_size;
size_t index_min = net_counter_index;
- float d = net_counter_time[index_max] - net_counter_time[index_min];
+ float d = float (net_counter_time[index_max] - net_counter_time[index_min]) / 1000.0f;
if (d > 0) {
float traffic = net_counter_traffic[index_max] - net_counter_traffic[index_min];
textstream << "^Nnet ^B" << std::setw(6) << roundf((float) traffic / d) << "\n";