Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Makefile.am4
-rw-r--r--src/server/server.cc4
-rw-r--r--src/server/timer.cc41
-rw-r--r--src/server/timer.h39
4 files changed, 4 insertions, 84 deletions
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index ed43cd7..bc2f741 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -1,6 +1,6 @@
METASOURCES = AUTO
-libserver_la_SOURCES = console.cc server.cc timer.cc
-noinst_HEADERS = console.h server.h timer.h
+libserver_la_SOURCES = console.cc server.cc
+noinst_HEADERS = console.h server.h
noinst_LTLIBRARIES = libserver.la
INCLUDES = -I$(top_srcdir)/src
libserver_la_LDFLAGS = -avoid-version -no-undefined
diff --git a/src/server/server.cc b/src/server/server.cc
index fce2181..27cf6bd 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -9,9 +9,9 @@
#include "core/core.h"
#include "core/stats.h"
+#include "core/timer.h"
#include "server/console.h"
#include "server/server.h"
-#include "server/timer.h"
namespace server {
@@ -77,7 +77,7 @@ void Server::run()
if (core::Cvar::sv_framerate->value())
server_framerate = 1.0f / core::Cvar::sv_framerate->value();
- server::Timer timer;
+ core::Timer timer;
float elapsed = 0;
while(connected()) {
diff --git a/src/server/timer.cc b/src/server/timer.cc
deleted file mode 100644
index 56075c7..0000000
--- a/src/server/timer.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- server/timer.cc
- This file is part of the Osirion project and is distributed under
- the terms and conditions of the GNU General Public License version 2
-*/
-
-#include "timer.h"
-
-#include <unistd.h>
-#include <iostream>
-
-namespace server {
-
-Timer::Timer()
-{
- gettimeofday(&this->timer_tick, &this->timer_tz);
- this->timer_elapsed = 0;
-}
-
-Timer::~Timer()
-{
-}
-
-void Timer::mark()
-{
- gettimeofday(&timer_tick, &timer_tz);
-}
-
-float Timer::elapsed()
-{
- struct timeval tick;
- struct timezone tick_tz;
-
- gettimeofday(&tick, &tick_tz);
-
- // calculate elapsed time in 10^-6 seconds
- long delta = (tick.tv_sec - timer_tick.tv_sec) * 1000000 + (tick.tv_usec - timer_tick.tv_usec);
- return( (float) delta / 1000000.0f);
-}
-
-}
diff --git a/src/server/timer.h b/src/server/timer.h
deleted file mode 100644
index 496d698..0000000
--- a/src/server/timer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __INCLUDED_TIMER_H__
-#define __INCLUDED_TIMER_H__
-
-#include <sys/time.h>
-
-namespace server {
-
-/// a timer measures intervals in seconds
-/*! A timer class measures the time elapsed
-* between the last two calls to its mark() function.
-*/
-class Timer {
-public:
- /// Constructor
- Timer();
- /// Destructor
- ~Timer();
-
- /// mark the current time as zero
- /*! Reset the timer, all subsequent calls too elapsed() will
- * use the current timestamp as reference
- */
- void mark();
-
- /*! return the time elapsed since the last mark
- * @see mark()
- */
- float elapsed();
-
-private:
- float timer_elapsed;
- struct timezone timer_tz;
- struct timeval timer_tick;
-}; // class Timer
-
-} // namespace server
-
-#endif // __INCLUDED_TIMER_H__
-