Ignore:
Timestamp:
Nov 26, 2009, 6:47:08 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2610 "avoid unnecessary calls to time(NULL)"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r9589 r9593  
    4545#include "version.h"
    4646
     47
    4748static tr_lock *      messageLock = NULL;
    4849static int            messageLevel = 0;
     
    5657    static void OutputDebugString( const void * unused UNUSED ) { }
    5758#endif
     59
     60/***
     61****
     62***/
     63
     64time_t transmission_now = 0;
     65
     66void
     67tr_timeUpdate( time_t now )
     68{
     69    transmission_now = now;
     70}
     71
     72/***
     73****
     74***/
     75
    5876
    5977static void
     
    202220{
    203221    char           tmp[64];
    204     time_t         now;
    205222    struct tm      now_tm;
    206223    struct timeval tv;
    207224    int            milliseconds;
    208225
    209     now = time( NULL );
    210226    gettimeofday( &tv, NULL );
    211227
    212     tr_localtime_r( &now, &now_tm );
     228    tr_localtime_r( &tv.tv_sec, &now_tm );
    213229    strftime( tmp, sizeof( tmp ), "%H:%M:%S", &now_tm );
    214230    milliseconds = (int)( tv.tv_usec / 1000 );
     
    326342                newmsg = tr_new0( tr_msg_list, 1 );
    327343                newmsg->level = level;
    328                 newmsg->when = time( NULL );
     344                newmsg->when = tr_time( );
    329345                newmsg->message = tr_strdup( buf );
    330346                newmsg->file = file;
Note: See TracChangeset for help on using the changeset viewer.