Index: code/branches/gui/src/core/Clock.cc
===================================================================
--- code/branches/gui/src/core/Clock.cc	(revision 1674)
+++ code/branches/gui/src/core/Clock.cc	(revision 1674)
@@ -0,0 +1,78 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief
+*/
+
+#include "Clock.h"
+#include <OgreTimer.h>
+
+namespace orxonox
+{
+    Clock::Clock()
+        : timer_(new Ogre::Timer())
+        , storedTime_(0)
+        , tickTime_(0)
+        , tickDt_(0)
+        , tickDtFloat_(0.0f)
+        , lastTimersTime_(0)
+    {
+    }
+
+    Clock::~Clock()
+    {
+        delete timer_;
+    }
+    
+    void Clock::capture()
+    {
+        unsigned long timersTime = timer_->getMicroseconds();
+        tickTime_ = storedTime_ + timersTime;
+        tickDt_ = timersTime - lastTimersTime_;
+        tickDtFloat_ = (float)tickDt_ / 1000000.0f;
+
+        if (timersTime > 0x7FFFFFF0)
+        {
+            // Ogre timer will overflow at 2^32 microseconds if unsigned long is 32 bit
+            storedTime_ += timersTime;
+            lastTimersTime_ = 0;
+            timer_->reset();
+        }
+        else
+        {
+            lastTimersTime_ = timersTime;
+        }
+    }
+
+    uint64_t Clock::getRealMicroseconds() const
+    {
+        return this->timer_->getMicroseconds();
+    }
+}
Index: code/branches/gui/src/core/Clock.h
===================================================================
--- code/branches/gui/src/core/Clock.h	(revision 1674)
+++ code/branches/gui/src/core/Clock.h	(revision 1674)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Reto Grieder
+ *
+ */
+
+/**
+    @file Core.h
+    @brief Declaration of the Core class.
+
+    The Core class is a singleton, only used to configure some variables
+    in the core through the config-file.
+*/
+
+#ifndef _Clock_H__
+#define _Clock_H__
+
+#include "CorePrereqs.h"
+#include <OgrePrerequisites.h>
+#include "util/Integers.h"
+
+namespace orxonox
+{
+    class _CoreExport Clock
+    {
+        friend RootGameState;
+
+    public:
+        Clock();
+        ~Clock();
+
+        uint64_t getMicroseconds()   const { return tickTime_; }
+        uint64_t getMilliseconds()   const { return tickTime_ / 1000; }
+        int      getSeconds()        const { return tickTime_ / 1000000; }
+        float    getSecondsPrecise() const { return (float)tickTime_ / 1000000.0f; }
+
+        float    getDeltaTime()      const { return tickDtFloat_; }
+        int      getDeltaTimeMicroseconds() const { return tickDt_; }
+
+        uint64_t getRealMicroseconds() const;
+
+    private:
+        Clock(const Clock& instance);
+        void capture();
+
+        Ogre::Timer*  timer_;
+        uint64_t      storedTime_;
+        uint64_t      tickTime_;
+        int           tickDt_;
+        float         tickDtFloat_;
+        unsigned long lastTimersTime_;
+    };
+}
+
+#endif /* _Clock_H__ */
Index: code/branches/gui/src/core/CorePrereqs.h
===================================================================
--- code/branches/gui/src/core/CorePrereqs.h	(revision 1673)
+++ code/branches/gui/src/core/CorePrereqs.h	(revision 1674)
@@ -162,5 +162,4 @@
 
   // game states
-  class BaseGameState;
   class GameState;
   class RootGameState;
Index: code/branches/gui/src/core/GameState.cc
===================================================================
--- code/branches/gui/src/core/GameState.cc	(revision 1673)
+++ code/branches/gui/src/core/GameState.cc	(revision 1674)
@@ -34,5 +34,4 @@
 
 #include "GameState.h"
-#include <cassert>
 #include "Debug.h"
 #include "Exception.h"
@@ -359,8 +358,8 @@
         This method is not virtual! You cannot override it therefore.
     */
-    void GameState::tick(float dt, uint64_t time)
+    void GameState::tick(const Clock& time)
     {
         this->operation_.running = true;
-        this->ticked(dt, time);
+        this->ticked(time);
         this->operation_.running = false;
     }
Index: code/branches/gui/src/core/GameState.h
===================================================================
--- code/branches/gui/src/core/GameState.h	(revision 1673)
+++ code/branches/gui/src/core/GameState.h	(revision 1674)
@@ -42,4 +42,5 @@
 #include <map>
 #include "util/Integers.h"
+#include "Clock.h"
 
 namespace orxonox
@@ -100,9 +101,9 @@
         virtual void enter() = 0;
         virtual void leave() = 0;
-        virtual void ticked(float dt, uint64_t time) = 0;
+        virtual void ticked(const Clock& time) = 0;
 
         GameState* getActiveChild() { return this->activeChild_; }
 
-        void tickChild(float dt, uint64_t time) { if (this->getActiveChild()) this->getActiveChild()->tick(dt, time); }
+        void tickChild(const Clock& time) { if (this->getActiveChild()) this->getActiveChild()->tick(time); }
 
     private:
@@ -113,5 +114,5 @@
         void grandchildRemoved(GameState* grandchild);
 
-        void tick(float dt, uint64_t time);
+        void tick(const Clock& time);
         void activate();
         void deactivate();
Index: code/branches/gui/src/core/RootGameState.cc
===================================================================
--- code/branches/gui/src/core/RootGameState.cc	(revision 1673)
+++ code/branches/gui/src/core/RootGameState.cc	(revision 1674)
@@ -29,6 +29,5 @@
 #include "RootGameState.h"
 
-#include <OgreTimer.h>
-#include "util/Integers.h"
+#include "Clock.h"
 #include "Debug.h"
 #include "Exception.h"
@@ -95,8 +94,4 @@
             if (current)
             {
-                //OrxAssert(dynamic_cast<GameState*>(current),
-                //    "RootGameState: There was a RootGameState in the subtree of Root");
-                //GameState* currentGS = static_cast<GameState*>(current);
-                //currentGS->makeTransition(this, request);
                 current->makeTransition(0, request);
             }
@@ -141,27 +136,10 @@
         gotoState(initialState);
 
-        Ogre::Timer timer;
-        uint64_t storedTime = 0;
-        unsigned long lastTimersTime = 1;
-        timer.reset();
+        Clock clock;
         while (this->activeChild_)
         {
-            // get current time
-            unsigned long timersTime = timer.getMicroseconds();
-            uint64_t realTime = storedTime + timersTime;
-            float dt = (float)(timersTime - lastTimersTime)/1000000.0f;
-            if (timersTime > 7000000)
-            {
-                // Under worst condition, the ogre timer will overflow right after 7 seconds
-                storedTime += timersTime;
-                lastTimersTime = 0;
-                timer.reset();
-            }
-            else
-            {
-                lastTimersTime = timersTime;
-            }
+            clock.capture();
 
-            this->tick(dt, realTime);
+            this->tick(clock);
 
             if (this->stateRequest_ != "")
Index: code/branches/gui/src/core/RootGameState.h
===================================================================
--- code/branches/gui/src/core/RootGameState.h	(revision 1673)
+++ code/branches/gui/src/core/RootGameState.h	(revision 1674)
@@ -31,5 +31,4 @@
 
 #include "CorePrereqs.h"
-#include <OgrePrerequisites.h>
 #include "GameState.h"
 
@@ -38,6 +37,4 @@
     class _CoreExport RootGameState : public GameState
     {
-        //friend class GameState;
-
     public:
         RootGameState(const std::string& name);
@@ -46,9 +43,4 @@
         void requestState(const std::string& name);
         void start();
-
-    protected:
-        //virtual void ticked(float dt) = 0;
-        //virtual void enter() = 0;
-        //virtual void leave() = 0;
 
     private:
Index: code/branches/gui/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/gui/src/orxonox/CMakeLists.txt	(revision 1673)
+++ code/branches/gui/src/orxonox/CMakeLists.txt	(revision 1674)
@@ -2,5 +2,4 @@
   GraphicsEngine.cc
   Main.cc
-  Orxonox.cc
   Radar.cc
   RadarListener.cc
Index: code/branches/gui/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/gui/src/orxonox/OrxonoxPrereqs.h	(revision 1673)
+++ code/branches/gui/src/orxonox/OrxonoxPrereqs.h	(revision 1674)
@@ -74,6 +74,4 @@
 
     class GraphicsEngine;
-    class Orxonox;
-    class RootGameState;
     class Settings;
 
Index: code/branches/gui/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSClient.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSClient.cc	(revision 1674)
@@ -78,10 +78,10 @@
     }
 
-    void GSClient::ticked(float dt, uint64_t time)
+    void GSClient::ticked(const Clock& time)
     {
-        GSLevel::ticked(dt, time);
-        client_->tick(dt);
+        GSLevel::ticked(time);
+        client_->tick(time.getDeltaTime());
 
-        this->tickChild(dt, time);
+        this->tickChild(time);
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSClient.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSClient.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSClient.h	(revision 1674)
@@ -46,5 +46,5 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
+        void ticked(const Clock& time);
 
         network::Client* client_;
Index: code/branches/gui/src/orxonox/gamestates/GSGUI.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGUI.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSGUI.cc	(revision 1674)
@@ -58,10 +58,10 @@
     }
 
-    void GSGUI::ticked(float dt, uint64_t time)
+    void GSGUI::ticked(const Clock& time)
     {
         // tick CEGUI
-        GUIManager::getInstance().tick(dt);
+        GUIManager::getInstance().tick(time.getDeltaTime());
 
-        this->tickChild(dt, time);
+        this->tickChild(time);
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSGUI.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGUI.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSGUI.h	(revision 1674)
@@ -44,6 +44,5 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
-
+        void ticked(const Clock& time);
     };
 }
Index: code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGraphics.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSGraphics.cc	(revision 1674)
@@ -32,5 +32,4 @@
 #include <OgreFrameListener.h>
 #include <OgreRoot.h>
-#include <OgreTimer.h>
 #include <OgreWindowEventUtilities.h>
 #include <OgreRenderWindow.h>
@@ -39,5 +38,4 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/input/InputManager.h"
-//#include "core/Core.h"
 #include "overlays/console/InGameConsole.h"
 #include "gui/GUIManager.h"
@@ -48,9 +46,14 @@
     GSGraphics::GSGraphics()
         : GameState("graphics")
-        , debugRefreshTime_(0.0f)
+        , ogreRoot_(0)
+        , graphicsEngine_(0)
         , inputManager_(0)
         , console_(0)
         , guiManager_(0)
         , frameCount_(0)
+        , statisticsRefreshCycle_(0)
+        , statisticsStartTime_(0)
+        , statisticsStartCount_(0)
+        , tickTime_(0)
     {
     }
@@ -62,9 +65,11 @@
     void GSGraphics::setConfigValues()
     {
-        SetConfigValue(debugRefreshTime_, 0.2).description("Sets the time interval at which average fps, etc. get updated.");
+        SetConfigValue(statisticsRefreshCycle_, 200000).description("Sets the time in microseconds interval at which average fps, etc. get updated.");
     }
 
     void GSGraphics::enter()
     {
+        setConfigValues();
+
         this->ogreRoot_ = Ogre::Root::getSingletonPtr();
         this->graphicsEngine_ = GraphicsEngine::getInstancePtr();
@@ -88,4 +93,10 @@
         guiManager_ = new GUIManager();
         guiManager_->initialise();
+
+        // reset frame counter
+        this->frameCount_ = 0;
+        this->tickTime_ = 0;
+        statisticsStartTime_ = 0;
+        statisticsStartCount_ = 0;
     }
 
@@ -117,28 +128,29 @@
         need the time. So we shouldn't run into problems.
     */
-    void GSGraphics::ticked(float dt, uint64_t time)
+    void GSGraphics::ticked(const Clock& time)
     {
+        uint64_t timeBeforeTick = time.getRealMicroseconds();
+        float dt = time.getDeltaTime();
+
         this->inputManager_->tick(dt);
-
-        this->tickChild(dt, time);
-
         // tick console
         this->console_->tick(dt);
+        this->tickChild(time);
+        
+        uint64_t timeAfterTick = time.getRealMicroseconds();
 
-        //// get current time once again
-        //timeAfterTick = timer_->getMicroseconds();
+        tickTime_ += (unsigned int)(timeAfterTick - timeBeforeTick);
+        if (timeAfterTick > statisticsStartTime_ + statisticsRefreshCycle_)
+        {
+            GraphicsEngine::getInstance().setAverageTickTime(
+                (float)tickTime_ * 0.001f / (frameCount_ - statisticsStartCount_));
+            float avgFPS = (float)(frameCount_ - statisticsStartCount_)
+                / (timeAfterTick - statisticsStartTime_) * 1000000.0;
+            GraphicsEngine::getInstance().setAverageFramesPerSecond(avgFPS);
 
-        //tickTime += timeAfterTick - timeBeforeTick;
-        //if (timeAfterTick > refreshStartTime + refreshTime)
-        //{
-        //    GraphicsEngine::getInstance().setAverageTickTime(
-        //        (float)tickTime * 0.001 / (frameCount - oldFrameCount));
-        //    float avgFPS = (float)(frameCount - oldFrameCount) / (timeAfterTick - refreshStartTime) * 1000000.0;
-        //    GraphicsEngine::getInstance().setAverageFramesPerSecond(avgFPS);
-
-        //    oldFrameCount = frameCount;
-        //    tickTime = 0;
-        //    refreshStartTime = timeAfterTick;
-        //}
+            tickTime_ = 0;
+            statisticsStartCount_ = frameCount_;
+            statisticsStartTime_  = timeAfterTick;
+        }
 
         // don't forget to call _fireFrameStarted in ogre to make sure
@@ -163,12 +175,4 @@
 
         ++frameCount_;
-
-        //}
-        //catch (std::exception& ex)
-        //{
-        //    // something went wrong.
-        //    COUT(1) << ex.what() << std::endl;
-        //    COUT(1) << "Main loop was stopped by an unhandled exception. Shutting down." << std::endl;
-        //}
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSGraphics.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSGraphics.h	(revision 1674)
@@ -48,27 +48,18 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
-
-        // config values
-        float                 debugRefreshTime_;
+        void ticked(const Clock& time);
 
         Ogre::Root*           ogreRoot_;
-        GraphicsEngine*       graphicsEngine_;   //!< our dearest graphics engine <3
+        GraphicsEngine*       graphicsEngine_;   //!< pointer to GraphicsEngine instance
         InputManager*         inputManager_;
         InGameConsole*        console_;
         GUIManager*           guiManager_;
 
-
         // variables for time statistics
         unsigned long         frameCount_;
-
-        //const unsigned long refreshTime = (unsigned long)(debugRefreshTime_ * 1000000.0f);
-        //unsigned long refreshStartTime;
-        //unsigned long tickTime;
-        //unsigned long oldFrameCount;
-
-        //unsigned long timeBeforeTick;
-        //unsigned long timeBeforeTickOld;
-        //unsigned long timeAfterTick;
+        unsigned int          statisticsRefreshCycle_;
+        uint64_t              statisticsStartTime_;
+        unsigned long         statisticsStartCount_;
+        unsigned int          tickTime_;
     };
 }
Index: code/branches/gui/src/orxonox/gamestates/GSIO.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSIO.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSIO.cc	(revision 1674)
@@ -30,17 +30,8 @@
 #include "GSIO.h"
 
-#include <OgreFrameListener.h>
-#include <OgreRoot.h>
-#include <OgreTimer.h>
-
-#include "core/ConsoleCommand.h"
-#include "core/TclThreadManager.h"
-#include "GraphicsEngine.h"
-
 namespace orxonox
 {
     GSIO::GSIO()
         : GameState("io")
-        //, timer_(0)
     {
     }
@@ -58,73 +49,7 @@
     }
 
-    void GSIO::ticked(float dt, uint64_t time)
+    void GSIO::ticked(const Clock& time)
     {
-        this->tickChild(dt, time);
-        //Ogre::Root& ogreRoot = Ogre::Root::getSingleton();
-
-        //unsigned long frameCount = 0;
-
-        //const unsigned long refreshTime = (unsigned long)(debugRefreshTime_ * 1000000.0f);
-        //unsigned long refreshStartTime = 0;
-        //unsigned long tickTime = 0;
-        //unsigned long oldFrameCount = 0;
-
-        //unsigned long timeBeforeTick = 0;
-        //unsigned long timeBeforeTickOld = 0;
-        //unsigned long timeAfterTick = 0;
-
-        //// TODO: Update time in seconds every 7 seconds to avoid any overflow (7 secs is very tight)
-
-        //COUT(3) << "Orxonox: Starting the main loop." << std::endl;
-
-        //try
-        //{
-        //    timer_->reset();
-        //    while (!this->hasScheduledTransition())
-        //    {
-        //        // get current time
-        //        timeBeforeTickOld = timeBeforeTick;
-        //        timeBeforeTick    = timer_->getMicroseconds();
-        //        float dt = (timeBeforeTick - timeBeforeTickOld) / 1000000.0;
-
-        //        TclThreadManager::getInstance().tick(dt);
-
-        //        this->tickChild(dt);
-
-        //        // get current time once again
-        //        timeAfterTick = timer_->getMicroseconds();
-
-        //        tickTime += timeAfterTick - timeBeforeTick;
-        //        if (timeAfterTick > refreshStartTime + refreshTime)
-        //        {
-        //            GraphicsEngine::getInstance().setAverageTickTime(
-        //                (float)tickTime * 0.001 / (frameCount - oldFrameCount));
-        //            float avgFPS = (float)(frameCount - oldFrameCount) / (timeAfterTick - refreshStartTime) * 1000000.0;
-        //            GraphicsEngine::getInstance().setAverageFramesPerSecond(avgFPS);
-
-        //            oldFrameCount = frameCount;
-        //            tickTime = 0;
-        //            refreshStartTime = timeAfterTick;
-        //        }
-
-        //        // don't forget to call _fireFrameStarted in ogre to make sure
-        //        // everything goes smoothly
-        //        Ogre::FrameEvent evt;
-        //        evt.timeSinceLastFrame = dt;
-        //        evt.timeSinceLastEvent = dt; // note: same time, but shouldn't matter anyway
-        //        ogreRoot._fireFrameStarted(evt);
-
-        //        // again, just to be sure ogre works fine
-        //        ogreRoot._fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
-
-        //        ++frameCount;
-        //    }
-        //}
-        //catch (std::exception& ex)
-        //{
-        //    // something went wrong.
-        //    COUT(1) << ex.what() << std::endl;
-        //    COUT(1) << "Main loop was stopped by an unhandled exception. Shutting down." << std::endl;
-        //}
+        this->tickChild(time);
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSIO.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSIO.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSIO.h	(revision 1674)
@@ -31,5 +31,4 @@
 
 #include "OrxonoxPrereqs.h"
-#include <OgrePrerequisites.h>
 #include "core/GameState.h"
 
@@ -45,7 +44,5 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
-
-        //Ogre::Timer*          timer_;            //!< Main loop timer
+        void ticked(const Clock& time);
     };
 }
Index: code/branches/gui/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSIOConsole.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSIOConsole.cc	(revision 1674)
@@ -58,5 +58,5 @@
     }
 
-    void GSIOConsole::ticked(float dt, uint64_t time)
+    void GSIOConsole::ticked(const Clock& time)
     {
         std::string command;
@@ -64,5 +64,5 @@
         CommandExecutor::execute(command, true);
         
-        tickChild(dt, time);
+        tickChild(time);
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSIOConsole.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSIOConsole.h	(revision 1674)
@@ -45,5 +45,5 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
+        void ticked(const Clock& time);
     };
 }
Index: code/branches/gui/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSLevel.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSLevel.cc	(revision 1674)
@@ -44,5 +44,5 @@
     GSLevel::GSLevel(const std::string& name)
         : GameState(name)
-        , timefactor_(1.0f)
+        , timeFactor_(1.0f)
         , keyBinder_(0)
         , inputState_(0)
@@ -74,4 +74,7 @@
         hud_ = new Level(Settings::getDataPath() + "overlay/hud.oxo");
         Loader::load(hud_);
+
+        // reset game speed to normal
+        timeFactor_ = 1.0f;
     }
 
@@ -96,12 +99,12 @@
     }
 
-    void GSLevel::ticked(float dt, uint64_t time)
+    void GSLevel::ticked(const Clock& time)
     {
         // Call those objects that need the real time
         for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it)
-            it->tick(dt);
+            it->tick(time.getDeltaTime());
         // Call the scene objects
         for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it)
-            it->tick(dt * this->timefactor_);
+            it->tick(time.getDeltaTime() * this->timeFactor_);
     }
 
@@ -112,11 +115,11 @@
     void GSLevel::setTimeFactor(float factor)
     {
-        float change = factor / this->timefactor_;
-        this->timefactor_ = factor;
+        float change = factor / this->timeFactor_;
+        this->timeFactor_ = factor;
         for (Iterator<ParticleInterface> it = ObjectList<ParticleInterface>::begin(); it; ++it)
             it->setSpeedFactor(it->getSpeedFactor() * change);
 
         for (Iterator<Backlight> it = ObjectList<Backlight>::begin(); it; ++it)
-            it->setTimeFactor(timefactor_);
+            it->setTimeFactor(timeFactor_);
     }
 
Index: code/branches/gui/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSLevel.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSLevel.h	(revision 1674)
@@ -44,10 +44,10 @@
         // when taking the function address.
         void setTimeFactor(float factor);
-        float getTimeFactor() { return this->timefactor_; }
+        float getTimeFactor() { return this->timeFactor_; }
 
     protected:
         virtual void enter();
         virtual void leave();
-        virtual void ticked(float dt, uint64_t time);
+        virtual void ticked(const Clock& time);
 
         void loadLevel();
@@ -56,5 +56,5 @@
     private:
 
-        float timefactor_;       //!< A factor to change the gamespeed
+        float timeFactor_;       //!< A factor to change the gamespeed
 
         KeyBinder*            keyBinder_;        //!< tool that loads and manages the input bindings
Index: code/branches/gui/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSRoot.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSRoot.cc	(revision 1674)
@@ -30,5 +30,5 @@
 #include "GSRoot.h"
 
-#include "util/SubString.h"
+//#include "util/SubString.h"
 #include "core/Factory.h"
 #include "core/ConfigFileManager.h"
@@ -39,9 +39,22 @@
 #include "core/Exception.h"
 #include "core/TclBind.h"
-#include "core/Core.h"
-#include "core/CommandLine.h"
 #include "core/TclThreadManager.h"
 #include "GraphicsEngine.h"
 #include "Settings.h"
+
+#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
+#  include "windows.h"
+
+   //Get around Windows hackery
+#  ifdef max
+#    undef max
+#  endif
+#  ifdef min
+#    undef min
+#  endif
+#endif
 
 namespace orxonox
@@ -119,4 +132,9 @@
         graphicsEngine_->setup();       // creates ogre root and other essentials
 
+        // limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
+        // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
+        // the timer though).
+        setThreadAffinity();
+
         // add console commands
         FunctorMember<GSRoot>* functor1 = createFunctor(&GSRoot::exitGame);
@@ -138,9 +156,46 @@
     }
 
-    void GSRoot::ticked(float dt, uint64_t time)
-    {
-        TclThreadManager::getInstance().tick(dt);
-
-        this->tickChild(dt, time);
+    void GSRoot::ticked(const Clock& time)
+    {
+        TclThreadManager::getInstance().tick(time.getDeltaTime());
+
+        this->tickChild(time);
+    }
+
+    /**
+    @note
+        The code of this function has been copied from OGRE, an open source graphics engine.
+            (Object-oriented Graphics Rendering Engine)
+        For the latest info, see http://www.ogre3d.org/
+
+        Copyright (c) 2000-2008 Torus Knot Software Ltd
+        
+        OGRE is licensed under the LGPL. For more info, see ogre license info.
+    */
+    void GSRoot::setThreadAffinity()
+    {
+#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+        // Get the current process core mask
+	    DWORD procMask;
+	    DWORD sysMask;
+#if _MSC_VER >= 1400 && defined (_M_X64)
+	    GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR)&procMask, (PDWORD_PTR)&sysMask);
+#else
+	    GetProcessAffinityMask(GetCurrentProcess(), &procMask, &sysMask);
+#endif
+
+	    // If procMask is 0, consider there is only one core available
+	    // (using 0 as procMask will cause an infinite loop below)
+	    if (procMask == 0)
+		    procMask = 1;
+
+	    // Find the lowest core that this process uses
+        DWORD threadMask = 1;
+	    while ((threadMask & procMask) == 0)
+		    threadMask <<= 1;
+
+	    // Set affinity to the first core
+	    SetThreadAffinityMask(GetCurrentThread(), threadMask);
+#endif
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSRoot.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSRoot.h	(revision 1674)
@@ -49,5 +49,7 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
+        void ticked(const Clock& time);
+
+        void setThreadAffinity();
 
         Settings*             settings_;
Index: code/branches/gui/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSServer.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSServer.cc	(revision 1674)
@@ -83,9 +83,9 @@
     }
 
-    void GSServer::ticked(float dt, uint64_t time)
+    void GSServer::ticked(const Clock& time)
     {
-        GSLevel::ticked(dt, time);
-        server_->tick(dt);
-        this->tickChild(dt, time);
+        GSLevel::ticked(time);
+        server_->tick(time.getDeltaTime());
+        this->tickChild(time);
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSServer.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSServer.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSServer.h	(revision 1674)
@@ -46,5 +46,5 @@
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
+        void ticked(const Clock& time);
 
         network::Server*      server_;
Index: code/branches/gui/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSStandalone.cc	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSStandalone.cc	(revision 1674)
@@ -70,9 +70,8 @@
     }
 
-    void GSStandalone::ticked(float dt, uint64_t time)
+    void GSStandalone::ticked(const Clock& time)
     {
-        GSLevel::ticked(dt, time);
-
-        this->tickChild(dt, time);
+        GSLevel::ticked(time);
+        this->tickChild(time);
     }
 }
Index: code/branches/gui/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- code/branches/gui/src/orxonox/gamestates/GSStandalone.h	(revision 1673)
+++ code/branches/gui/src/orxonox/gamestates/GSStandalone.h	(revision 1674)
@@ -41,9 +41,8 @@
         ~GSStandalone();
 
-
     private:
         void enter();
         void leave();
-        void ticked(float dt, uint64_t time);
+        void ticked(const Clock& time);
     };
 }
