Changeset 10998
- Timestamp:
- Jul 11, 2010, 8:49:19 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bandwidth.c
r10931 r10998 35 35 { 36 36 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; 38 38 int i = r->newest; 39 39 … … 382 382 tr_bool isPieceData ) 383 383 { 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 348 348 if( !init ) 349 349 { 350 srand( tr_ date( ) );350 srand( tr_time_msec( ) ); 351 351 init = TRUE; 352 352 } -
trunk/libtransmission/fdlimit.c
r10901 r10998 475 475 if( ( match != NULL ) && ( !doWrite || match->isWritable ) ) 476 476 { 477 match->date = tr_ date( );477 match->date = tr_time_msec( ); 478 478 return match->fd; 479 479 } … … 533 533 while( winner < 0 ) 534 534 { 535 uint64_t date = tr_ date( ) + 1;535 uint64_t date = tr_time_msec( ) + 1; 536 536 537 537 /* look for the file that's been open longest */ … … 583 583 o->torrentId = torrentId; 584 584 o->fileNum = fileNum; 585 o->date = tr_ date( );585 o->date = tr_time_msec( ); 586 586 return o->fd; 587 587 } -
trunk/libtransmission/history.c
r10909 r10998 45 45 { 46 46 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; 48 48 int i = h->newest; 49 49 -
trunk/libtransmission/history.h
r10909 r10998 40 40 /** 41 41 * @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() 43 43 * @param n how many items to add to the history's counter 44 44 */ … … 47 47 /** 48 48 * @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() 50 50 * @param seconds how many seconds to count back through. 51 51 */ -
trunk/libtransmission/peer-mgr.c
r10946 r10998 1184 1184 1185 1185 now = tr_time( ); 1186 now_msec = tr_ date( );1186 now_msec = tr_time_msec( ); 1187 1187 too_old = now - REQUEST_TTL_SECS; 1188 1188 … … 1438 1438 1439 1439 if( peer != NULL ) 1440 tr_historyAdd( peer->blocksSentToClient, tr_ date( ), 1 );1440 tr_historyAdd( peer->blocksSentToClient, tr_time_msec( ), 1 ); 1441 1441 1442 1442 if( tr_cpBlockIsComplete( &tor->completion, block ) ) … … 2287 2287 assert( webseedCount == tor->info.webseedCount ); 2288 2288 ret = tr_new0( double, webseedCount ); 2289 now = tr_ date( );2289 now = tr_time_msec( ); 2290 2290 2291 2291 for( i=0; i<webseedCount; ++i ) { … … 2325 2325 peers = (const tr_peer**) tr_ptrArrayBase( &t->peers ); 2326 2326 ret = tr_new0( tr_peer_stat, size ); 2327 now = tr_ date( );2327 now = tr_time_msec( ); 2328 2328 2329 2329 for( i=0; i<size; ++i ) … … 2418 2418 { 2419 2419 int i; 2420 const uint64_t now = tr_ date( );2420 const uint64_t now = tr_time_msec( ); 2421 2421 const int msec = 60 * 1000; 2422 2422 const int MIN_INTERESTING_PEERS = 5; … … 2744 2744 managerLock( mgr ); 2745 2745 2746 now = tr_ date( );2746 now = tr_time_msec( ); 2747 2747 while(( tor = tr_torrentNext( mgr->session, tor ))) { 2748 2748 if( tor->isRunning ) { … … 2853 2853 ret[outsize++] = peers[i]; 2854 2854 2855 sortPeersByLivelinessReverse ( ret, NULL, outsize, tr_ date( ) );2855 sortPeersByLivelinessReverse ( ret, NULL, outsize, tr_time_msec( ) ); 2856 2856 2857 2857 *setmeSize = outsize; … … 3101 3101 tr_torrent * tor; 3102 3102 tr_peerMgr * mgr = vmgr; 3103 const uint64_t now = tr_ date( );3103 const uint64_t now = tr_time_msec( ); 3104 3104 3105 3105 /** … … 3446 3446 struct peer_candidate * walk; 3447 3447 const time_t now = tr_time( ); 3448 const uint64_t now_msec = tr_ date( );3448 const uint64_t now_msec = tr_time_msec( ); 3449 3449 /* leave 5% of connection slots for incoming connections -- ticket #2609 */ 3450 3450 const int maxCandidates = tr_sessionGetPeerLimit( session ) * 0.95; -
trunk/libtransmission/peer-msgs.c
r10945 r10998 1396 1396 dbgmsg( msgs, "got Unchoke" ); 1397 1397 msgs->peer->clientIsChoked = 0; 1398 updateDesiredRequestCount( msgs, tr_ date( ) );1398 updateDesiredRequestCount( msgs, tr_time_msec( ) ); 1399 1399 break; 1400 1400 … … 1456 1456 tr_peerIoReadUint32( msgs->peer->io, inbuf, &r.offset ); 1457 1457 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 ); 1459 1459 dbgmsg( msgs, "got a Cancel %u:%u->%u", r.index, r.offset, r.length ); 1460 1460 … … 1930 1930 bytesWritten += EVBUFFER_LENGTH( out ); 1931 1931 msgs->clientSentAnythingAt = now; 1932 tr_historyAdd( msgs->peer->blocksSentToPeer, tr_ date( ), 1 );1932 tr_historyAdd( msgs->peer->blocksSentToPeer, tr_time_msec( ), 1 ); 1933 1933 } 1934 1934 … … 1973 1973 1974 1974 if ( tr_isPeerIo( msgs->peer->io ) ) { 1975 updateDesiredRequestCount( msgs, tr_ date( ) );1975 updateDesiredRequestCount( msgs, tr_time_msec( ) ); 1976 1976 updateBlockRequests( msgs ); 1977 1977 updateMetadataRequests( msgs, now ); … … 2361 2361 2362 2362 tr_peerIoSetIOFuncs( m->peer->io, canRead, didWrite, gotError, m ); 2363 updateDesiredRequestCount( m, tr_ date( ) );2363 updateDesiredRequestCount( m, tr_time_msec( ) ); 2364 2364 2365 2365 return m; -
trunk/libtransmission/ratecontrol.c
r10931 r10998 37 37 { 38 38 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; 40 40 int i = r->newest; 41 41 … … 77 77 size_t size ) 78 78 { 79 const uint64_t now = tr_ date( );79 const uint64_t now = tr_time_msec ( ); 80 80 81 81 if( r->transfers[r->newest].date + TR_RC_GRANULARITY_MSEC >= now ) -
trunk/libtransmission/torrent.c
r10996 r10998 977 977 s->peersFrom ); 978 978 979 now = tr_ date( );979 now = tr_time_msec( ); 980 980 d = tr_peerMgrGetWebseedSpeed_Bps( tor, now ); 981 981 s->rawUploadSpeed_KBps = toSpeedKBps( tr_bandwidthGetRawSpeed_Bps ( tor->bandwidth, now, TR_UP ) ); -
trunk/libtransmission/utils.c
r10987 r10998 786 786 787 787 uint64_t 788 tr_ date( void )788 tr_time_msec( void ) 789 789 { 790 790 struct timeval tv; -
trunk/libtransmission/utils.h
r10986 r10998 266 266 267 267 /** @brief return the current date in milliseconds */ 268 uint64_t tr_ date( void );268 uint64_t tr_time_msec( void ); 269 269 270 270 /** @brief sleep the specified number of milliseconds */
Note: See TracChangeset
for help on using the changeset viewer.