Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2008, 3:27:39 PM (16 years ago)
Author:
rgrieder
Message:

Moved tick time measurement to GSRoot. The values get combined with the one from GSGraphics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/gamestates/GSDedicated.cc

    r2415 r2549  
    7474    void GSDedicated::ticked(const Clock& time)
    7575    {
    76 //         static float startTime = time.getSecondsPrecise();
    77 //         static int nrOfTicks = 0;
    78         timeSinceLastUpdate_+=time.getDeltaTime();
    79         if(timeSinceLastUpdate_>=NETWORK_PERIOD){
    80 //             ++nrOfTicks;
    81 //             COUT(0) << "estimated ticks/sec: " << nrOfTicks/(time.getSecondsPrecise()-startTime) << endl;
    82             timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
     76//        static float startTime = time.getSecondsPrecise();
     77//        static int nrOfTicks = 0;
     78        timeSinceLastUpdate_ += time.getDeltaTime();
     79        if (timeSinceLastUpdate_ >= NETWORK_PERIOD)
     80        {
     81//            ++nrOfTicks;
     82//            COUT(0) << "estimated ticks/sec: " << nrOfTicks/(time.getSecondsPrecise()-startTime) << endl;
     83            timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD;
    8384            GSLevel::ticked(time);
    8485            server_->tick(time.getDeltaTime());
     
    8788        else
    8889        {
    89             usleep( (int)( (NETWORK_PERIOD - timeSinceLastUpdate_)*1000*1000 ) );
    90 //             COUT(0) << "sleeping for " << (int)( (NETWORK_PERIOD - timeSinceLastUpdate_)*1000*1000 ) << " usec" << endl;
     90            usleep((int)((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000));
     91//            COUT(0) << "sleeping for " << (int)((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;
    9192        }
    9293    }
Note: See TracChangeset for help on using the changeset viewer.