Changeset 12059


Ignore:
Timestamp:
Mar 1, 2011, 3:23:13 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #4047 "transfer speed shown as 0" -- revert r11783 (#3950) because it caused speed misreporting.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-io.c

    r11975 r12059  
    109109        const unsigned int overhead =
    110110            io->socket ? guessPacketOverhead( payload ) : 0;
    111         const uint64_t now = tr_sessionGetTimeMsec( io->session );
     111        const uint64_t now = tr_time_msec( );
    112112
    113113        tr_bandwidthUsed( &io->bandwidth, TR_UP, payload, next->isPieceData, now );
     
    149149    if( io->canRead )
    150150    {
    151         const uint64_t now = tr_sessionGetTimeMsec( io->session );
     151        const uint64_t now = tr_time_msec( );
    152152
    153153        tr_sessionLock( session );
  • trunk/libtransmission/peer-mgr.c

    r12041 r12059  
    31013101    tr_torrent * tor = NULL;
    31023102    tr_peerMgr * mgr = vmgr;
    3103     const uint64_t now = tr_sessionGetTimeMsec( mgr->session );
     3103    const uint64_t now = tr_time_msec( );
    31043104
    31053105    managerLock( mgr );
     
    34323432    tr_peerMgr * mgr = vmgr;
    34333433    const time_t now_sec = tr_time( );
    3434     const uint64_t now_msec = tr_sessionGetTimeMsec( mgr->session );
     3434    const uint64_t now_msec = tr_time_msec( );
    34353435
    34363436    /**
  • trunk/libtransmission/session.c

    r12012 r12059  
    26112611    session->curl_easy_config_func = func;
    26122612}
    2613 
    2614 /***
    2615 ****
    2616 ***/
    2617 
    2618 uint64_t
    2619 tr_sessionGetTimeMsec( tr_session * session )
    2620 {
    2621     struct timeval tv;
    2622 
    2623     if( event_base_gettimeofday_cached( session->event_base, &tv ) )
    2624     {
    2625         return tr_time_msec( );
    2626     }
    2627     else
    2628     {
    2629         /* event_base_gettimeofday_cached() might be implemented using
    2630            clock_gettime(CLOCK_MONOTONIC), so calculate the offset to
    2631            real time... */
    2632         static uint64_t offset;
    2633         static tr_bool offset_calculated = FALSE;
    2634 
    2635         const uint64_t val = (uint64_t) tv.tv_sec * 1000 + ( tv.tv_usec / 1000 );
    2636 
    2637         if( !offset_calculated )
    2638         {
    2639             offset = tr_time_msec() - val;
    2640             offset_calculated = TRUE;
    2641         }
    2642 
    2643         return val + offset;
    2644     }
    2645 }
  • trunk/libtransmission/session.h

    r11922 r12059  
    307307                                            int               * setme );
    308308
    309 
    310 /**
    311  * Tries to use libevent's cached timeval so we can avoid excessive calls
    312  * to gettimeofday().
    313  *
    314  * This isn't for all uses, but should be reasonably accurate when called
    315  * near the beginning of a libevent callback.
    316  */
    317 uint64_t tr_sessionGetTimeMsec( tr_session * session );
    318 
    319 
    320309#endif
Note: See TracChangeset for help on using the changeset viewer.