Changeset 10998


Ignore:
Timestamp:
Jul 11, 2010, 8:49:19 PM (12 years ago)
Author:
charles
Message:

(trunk libt) rename tr_date() as tr_time_msec() for clarity

Location:
trunk/libtransmission
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bandwidth.c

    r10931 r10998  
    3535{
    3636    uint64_t       bytes = 0;
    37     const uint64_t cutoff = (now?now:tr_date()) - interval_msec;
     37    const uint64_t cutoff = (now?now:tr_time_msec()) - interval_msec;
    3838    int            i = r->newest;
    3939
     
    382382                  tr_bool         isPieceData )
    383383{
    384     bandwidthUsedImpl( b, dir, byteCount, isPieceData, tr_date( ) );
    385 }
     384    bandwidthUsedImpl( b, dir, byteCount, isPieceData, tr_time_msec( ) );
     385}
  • trunk/libtransmission/crypto.c

    r10912 r10998  
    348348    if( !init )
    349349    {
    350         srand( tr_date( ) );
     350        srand( tr_time_msec( ) );
    351351        init = TRUE;
    352352    }
  • trunk/libtransmission/fdlimit.c

    r10901 r10998  
    475475    if( ( match != NULL ) && ( !doWrite || match->isWritable ) )
    476476    {
    477         match->date = tr_date( );
     477        match->date = tr_time_msec( );
    478478        return match->fd;
    479479    }
     
    533533    while( winner < 0 )
    534534    {
    535         uint64_t date = tr_date( ) + 1;
     535        uint64_t date = tr_time_msec( ) + 1;
    536536
    537537        /* look for the file that's been open longest */
     
    583583    o->torrentId = torrentId;
    584584    o->fileNum = fileNum;
    585     o->date = tr_date( );
     585    o->date = tr_time_msec( );
    586586    return o->fd;
    587587}
  • trunk/libtransmission/history.c

    r10909 r10998  
    4545{
    4646    unsigned int n = 0;
    47     const uint64_t cutoff = (now?now:tr_date()) - msec;
     47    const uint64_t cutoff = (now?now:tr_time_msec()) - msec;
    4848    int i = h->newest;
    4949
  • trunk/libtransmission/history.h

    r10909 r10998  
    4040/**
    4141 * @brief add a counter to the recent history object.
    42  * @param when the current time in msec, such as from tr_date()
     42 * @param when the current time in msec, such as from tr_time_msec()
    4343 * @param n how many items to add to the history's counter
    4444 */
     
    4747/**
    4848 * @brief count how many events have occurred in the last N seconds.
    49  * @param when the current time in msec, such as from tr_date()
     49 * @param when the current time in msec, such as from tr_time_msec()
    5050 * @param seconds how many seconds to count back through.
    5151 */
  • trunk/libtransmission/peer-mgr.c

    r10946 r10998  
    11841184
    11851185    now = tr_time( );
    1186     now_msec = tr_date( );
     1186    now_msec = tr_time_msec( );
    11871187    too_old = now - REQUEST_TTL_SECS;
    11881188
     
    14381438
    14391439            if( peer != NULL )
    1440                 tr_historyAdd( peer->blocksSentToClient, tr_date( ), 1 );
     1440                tr_historyAdd( peer->blocksSentToClient, tr_time_msec( ), 1 );
    14411441
    14421442            if( tr_cpBlockIsComplete( &tor->completion, block ) )
     
    22872287    assert( webseedCount == tor->info.webseedCount );
    22882288    ret = tr_new0( double, webseedCount );
    2289     now = tr_date( );
     2289    now = tr_time_msec( );
    22902290
    22912291    for( i=0; i<webseedCount; ++i ) {
     
    23252325    peers = (const tr_peer**) tr_ptrArrayBase( &t->peers );
    23262326    ret = tr_new0( tr_peer_stat, size );
    2327     now = tr_date( );
     2327    now = tr_time_msec( );
    23282328
    23292329    for( i=0; i<size; ++i )
     
    24182418{
    24192419    int i;
    2420     const uint64_t now = tr_date( );
     2420    const uint64_t now = tr_time_msec( );
    24212421    const int msec = 60 * 1000;
    24222422    const int MIN_INTERESTING_PEERS = 5;
     
    27442744    managerLock( mgr );
    27452745
    2746     now = tr_date( );
     2746    now = tr_time_msec( );
    27472747    while(( tor = tr_torrentNext( mgr->session, tor ))) {
    27482748        if( tor->isRunning ) {
     
    28532853            ret[outsize++] = peers[i];
    28542854
    2855     sortPeersByLivelinessReverse ( ret, NULL, outsize, tr_date( ) );
     2855    sortPeersByLivelinessReverse ( ret, NULL, outsize, tr_time_msec( ) );
    28562856
    28572857    *setmeSize = outsize;
     
    31013101    tr_torrent * tor;
    31023102    tr_peerMgr * mgr = vmgr;
    3103     const uint64_t now = tr_date( );
     3103    const uint64_t now = tr_time_msec( );
    31043104
    31053105    /**
     
    34463446    struct peer_candidate * walk;
    34473447    const time_t now = tr_time( );
    3448     const uint64_t now_msec = tr_date( );
     3448    const uint64_t now_msec = tr_time_msec( );
    34493449    /* leave 5% of connection slots for incoming connections -- ticket #2609 */
    34503450    const int maxCandidates = tr_sessionGetPeerLimit( session ) * 0.95;
  • trunk/libtransmission/peer-msgs.c

    r10945 r10998  
    13961396            dbgmsg( msgs, "got Unchoke" );
    13971397            msgs->peer->clientIsChoked = 0;
    1398             updateDesiredRequestCount( msgs, tr_date( ) );
     1398            updateDesiredRequestCount( msgs, tr_time_msec( ) );
    13991399            break;
    14001400
     
    14561456            tr_peerIoReadUint32( msgs->peer->io, inbuf, &r.offset );
    14571457            tr_peerIoReadUint32( msgs->peer->io, inbuf, &r.length );
    1458             tr_historyAdd( msgs->peer->cancelsSentToClient, tr_date( ), 1 );
     1458            tr_historyAdd( msgs->peer->cancelsSentToClient, tr_time_msec( ), 1 );
    14591459            dbgmsg( msgs, "got a Cancel %u:%u->%u", r.index, r.offset, r.length );
    14601460
     
    19301930                bytesWritten += EVBUFFER_LENGTH( out );
    19311931                msgs->clientSentAnythingAt = now;
    1932                 tr_historyAdd( msgs->peer->blocksSentToPeer, tr_date( ), 1 );
     1932                tr_historyAdd( msgs->peer->blocksSentToPeer, tr_time_msec( ), 1 );
    19331933            }
    19341934
     
    19731973
    19741974    if ( tr_isPeerIo( msgs->peer->io ) ) {
    1975         updateDesiredRequestCount( msgs, tr_date( ) );
     1975        updateDesiredRequestCount( msgs, tr_time_msec( ) );
    19761976        updateBlockRequests( msgs );
    19771977        updateMetadataRequests( msgs, now );
     
    23612361
    23622362    tr_peerIoSetIOFuncs( m->peer->io, canRead, didWrite, gotError, m );
    2363     updateDesiredRequestCount( m, tr_date( ) );
     2363    updateDesiredRequestCount( m, tr_time_msec( ) );
    23642364
    23652365    return m;
  • trunk/libtransmission/ratecontrol.c

    r10931 r10998  
    3737{
    3838    uint64_t       bytes = 0;
    39     const uint64_t cutoff = (now?now:tr_date()) - interval_msec;
     39    const uint64_t cutoff = (now?now:tr_time_msec()) - interval_msec;
    4040    int            i = r->newest;
    4141
     
    7777                  size_t           size )
    7878{
    79     const uint64_t now = tr_date ( );
     79    const uint64_t now = tr_time_msec ( );
    8080
    8181    if( r->transfers[r->newest].date + TR_RC_GRANULARITY_MSEC >= now )
  • trunk/libtransmission/torrent.c

    r10996 r10998  
    977977                            s->peersFrom );
    978978
    979     now = tr_date( );
     979    now = tr_time_msec( );
    980980    d = tr_peerMgrGetWebseedSpeed_Bps( tor, now );
    981981    s->rawUploadSpeed_KBps     = toSpeedKBps( tr_bandwidthGetRawSpeed_Bps  ( tor->bandwidth, now, TR_UP ) );
  • trunk/libtransmission/utils.c

    r10987 r10998  
    786786
    787787uint64_t
    788 tr_date( void )
     788tr_time_msec( void )
    789789{
    790790    struct timeval tv;
  • trunk/libtransmission/utils.h

    r10986 r10998  
    266266
    267267/** @brief return the current date in milliseconds */
    268 uint64_t tr_date( void );
     268uint64_t tr_time_msec( void );
    269269
    270270/** @brief sleep the specified number of milliseconds */
Note: See TracChangeset for help on using the changeset viewer.