Changeset 5922


Ignore:
Timestamp:
May 23, 2008, 8:04:41 PM (14 years ago)
Author:
charles
Message:
  • change tr_stat.activityDate's and tr_stat.startedDate's type to time_t, since that's how everyone uses them anyway
  • add a little more documentation to tr_stat and tr_ctor in transmission.h
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r5911 r5922  
    718718****/
    719719
     720static void
     721refresh_time_lb( GtkWidget * l, time_t t )
     722{
     723    const char * never = _( "Never" );
     724    if( !t )
     725        gtk_label_set_text( GTK_LABEL( l ), never );
     726    else {
     727        char * str = rfc822date( t );
     728        gtk_label_set_text( GTK_LABEL( l ), str );
     729        g_free( str );
     730    }
     731}
     732
    720733static GtkWidget*
    721734info_page_new (tr_torrent * tor)
     
    772785    hig_workarea_add_row (t, &row, _("Creator:"), l, NULL);
    773786
    774     pch = rfc822date ((guint64)info->dateCreated * 1000u);
    775     l = gtk_label_new (pch);
     787    l = gtk_label_new( NULL );
     788    refresh_time_lb( l, info->dateCreated );
    776789    hig_workarea_add_row (t, &row, _("Date:"), l, NULL);
    777     g_free (pch);
    778790
    779791  hig_workarea_add_section_divider (t, &row);
     
    864876                      *stat->errorString ? stat->errorString : _("None"));
    865877
    866   pch = stat->startDate ? rfc822date( stat->startDate )
    867                         : g_strdup_printf( _( "Unknown" ) );
    868   gtk_label_set_text (GTK_LABEL(a->date_added_lb), pch);
    869   g_free (pch);
    870 
    871   pch = stat->activityDate ? rfc822date( stat->activityDate )
    872                            : g_strdup_printf( _( "Unknown" ) );
    873   gtk_label_set_text (GTK_LABEL(a->last_activity_lb), pch);
    874   g_free (pch);
     878  refresh_time_lb( a->date_added_lb, stat->startDate );
     879
     880  refresh_time_lb( a->last_activity_lb, stat->activityDate );
    875881
    876882#ifdef SHOW_PIECES
     
    11891195        tr_strltime( buf, seconds, sizeof( buf ) );
    11901196        gtk_label_set_text( GTK_LABEL( l ), buf );
    1191     }
    1192 }
    1193 
    1194 static void
    1195 refresh_time_lb( GtkWidget * l, time_t t )
    1196 {
    1197     const char * never = _( "Never" );
    1198     if( !t )
    1199         gtk_label_set_text( GTK_LABEL( l ), never );
    1200     else {
    1201         char * str = rfc822date( (guint64)t * 1000 );
    1202         gtk_label_set_text( GTK_LABEL( l ), str );
    1203         g_free( str );
    12041197    }
    12051198}
  • trunk/gtk/msgwin.c

    r5491 r5922  
    9898                                COL_TR_MSG, &node,
    9999                                -1 );
    100             date = rfc822date( (guint64)node->when * 1000u );
     100            date = rfc822date( node->when );
    101101            switch( node->level ) {
    102102                case TR_MSG_DBG: levelStr = "debug"; break;
  • trunk/gtk/util.c

    r5903 r5922  
    174174
    175175char *
    176 rfc822date (guint64 epoch_msec)
    177 {
    178     const time_t secs = epoch_msec / 1000;
    179     const struct tm tm = *localtime (&secs);
     176rfc822date( time_t time )
     177{
     178    const struct tm tm = *localtime( &time );
    180179    char buf[128];
    181180    strftime( buf, sizeof(buf), "%a, %d %b %Y %T %Z", &tm );
  • trunk/gtk/util.h

    r5903 r5922  
    5555char* tr_strltime( char * buf, int secs, size_t buflen );
    5656
    57 char *
    58 rfc822date (guint64 epoch_msec);
     57char* rfc822date( time_t epoch_sec );
    5958
    6059/* create a directory and any missing parent directories */
  • trunk/libtransmission/peer-msgs.c

    r5913 r5922  
    11581158    const time_t now = time( NULL );
    11591159    tr_torrent * tor = msgs->torrent;
    1160     tor->activityDate = tr_date( );
     1160    tor->activityDate = now;
    11611161    tor->downloadedCur += byteCount;
    11621162    msgs->info->pieceDataActivityDate = now;
     
    13811381    const time_t now = time( NULL );
    13821382    tr_torrent * tor = msgs->torrent;
    1383     tor->activityDate = tr_date( );
     1383    tor->activityDate = now;
    13841384    tor->uploadedCur += byteCount;
    13851385    msgs->info->pieceDataActivityDate = now;
  • trunk/libtransmission/torrent-ctor.c

    r5843 r5922  
    3131};
    3232
     33/** Opaque class used when instantiating torrents.
     34  * @ingroup tr_ctor */
    3335struct tr_ctor
    3436{
  • trunk/libtransmission/torrent.c

    r5913 r5922  
    10041004    tor->cpStatus = tr_cpGetStatus( tor->completion );
    10051005    tr_torrentSaveResume( tor );
    1006     tor->startDate = tr_date( );
     1006    tor->startDate = time( NULL );
    10071007    tr_trackerStart( tor->tracker );
    10081008    tr_peerMgrStartTorrent( tor->handle->peerMgr, tor->info.hash );
  • trunk/libtransmission/torrent.h

    r5843 r5922  
    160160    uint64_t                   corruptPrev;
    161161
    162     uint64_t                   startDate;
    163     uint64_t                   stopDate;
    164     uint64_t                   activityDate;
     162    time_t                     startDate;
     163    time_t                     activityDate;
    165164
    166165    tr_torrent_status_func   * status_func;
  • trunk/libtransmission/transmission.h

    r5913 r5922  
    5555const char* tr_getDefaultConfigDir( void );
    5656
     57typedef struct tr_ctor tr_ctor;
    5758typedef struct tr_handle tr_handle;
     59typedef struct tr_info tr_info;
     60typedef struct tr_stat tr_stat;
    5861typedef struct tr_torrent tr_torrent;
    59 typedef struct tr_ctor tr_ctor;
     62
    6063
    6164/**
     
    424427
    425428
     429/** @addtogroup tr_ctor Torrent Instantiation
     430    @{
     431
     432    Instantiating a tr_torrent had gotten more complicated as features were
     433    added.  At one point there were four functions to check metainfo and five
     434    to create tr_torrent.
     435 
     436    To remedy this, a Torrent Constructor (struct tr_ctor) has been introduced:
     437    - Simplifies the API to two functions: tr_torrentParse() and tr_torrentNew()
     438    - You can set the fields you want; the system sets defaults for the rest.
     439    - You can specify whether or not your fields should supercede resume's.
     440    - We can add new features to tr_ctor without breaking tr_torrentNew()'s API.
     441 
     442    All the tr_ctor{Get,Set}*() functions with a return value return
     443    an error number, or zero if no error occurred.
     444 
     445    You must call one of the SetMetainfo() functions before creating
     446    a torrent with a tr_ctor.  The other functions are optional.
     447 
     448    You can reuse a single tr_ctor to create a batch of torrents --
     449    just call one of the SetMetainfo() functions between each
     450    tr_torrentNew() call.
     451 
     452    Every call to tr_ctorSetMetainfo*() frees the previous metainfo.
     453 */
     454
     455typedef enum
     456{
     457    TR_FALLBACK, /* indicates the ctor value should be used only
     458                    in case of missing resume settings */
     459
     460    TR_FORCE, /* indicates the ctor value should be used
     461                 regardless of what's in the resume settings */
     462}
     463tr_ctorMode;
     464
     465struct tr_benc;
     466
     467tr_ctor* tr_ctorNew                    ( const tr_handle  * handle);
     468
     469void     tr_ctorFree                   ( tr_ctor        * ctor );
     470
     471void     tr_ctorSetSave                ( tr_ctor        * ctor,
     472                                         int     saveMetadataInOurTorrentsDir );
     473
     474void     tr_ctorSetDeleteSource       ( tr_ctor        * ctor,
     475                                         uint8_t          doDelete );
     476
     477int      tr_ctorSetMetainfo            ( tr_ctor        * ctor,
     478                                         const uint8_t  * metainfo,
     479                                         size_t           len );
     480
     481int      tr_ctorSetMetainfoFromFile    ( tr_ctor        * ctor,
     482                                         const char     * filename );
     483
     484int      tr_ctorSetMetainfoFromHash    ( tr_ctor        * ctor,
     485                                         const char     * hashString );
     486
     487/** Set the maximum number of peers this torrent can connect to.
     488    (Default: 50) */
     489void     tr_ctorSetPeerLimit           ( tr_ctor        * ctor,
     490                                         tr_ctorMode      mode,
     491                                         uint16_t         peerLimit  );
     492
     493/** Set the download folder for the torrent being added with this ctor.
     494    @see tr_ctorSetDownloadDir()
     495    @see tr_sessionInitFull() */
     496void     tr_ctorSetDownloadDir         ( tr_ctor        * ctor,
     497                                         tr_ctorMode      mode,
     498                                         const char     * directory );
     499
     500/** Set whether or not the torrent begins downloading/seeding when created.
     501    (Default: not paused) */
     502void     tr_ctorSetPaused              ( tr_ctor        * ctor,
     503                                         tr_ctorMode      mode,
     504                                         uint8_t          isPaused );
     505
     506int      tr_ctorGetPeerLimit           ( const tr_ctor  * ctor,
     507                                         tr_ctorMode      mode,
     508                                         uint16_t       * setmeCount );
     509
     510int      tr_ctorGetPaused              ( const tr_ctor  * ctor,
     511                                         tr_ctorMode      mode,
     512                                         uint8_t        * setmeIsPaused );
     513
     514int      tr_ctorGetDownloadDir         ( const tr_ctor  * ctor,
     515                                         tr_ctorMode      mode,
     516                                         const char    ** setmeDownloadDir );
     517
     518int      tr_ctorGetMetainfo            ( const tr_ctor  * ctor,
     519                                         const struct tr_benc ** setme );
     520
     521int      tr_ctorGetSave                ( const tr_ctor  * ctor );
     522 
     523int      tr_ctorGetDeleteSource        ( const tr_ctor  * ctor,
     524                                         uint8_t        * setmeDoDelete );
     525
     526/* returns NULL if tr_ctorSetMetainfoFromFile() wasn't used */
     527const char* tr_ctorGetSourceFile       ( const tr_ctor  * ctor );
     528
     529#define TR_EINVALID     1
     530#define TR_EDUPLICATE   2
     531
     532/**
     533 * Parses the specified metainfo.
     534 * Returns TR_OK if it parsed and can be added to Transmission.
     535 * Returns TR_EINVALID if it couldn't be parsed.
     536 * Returns TR_EDUPLICATE if it parsed but can't be added.
     537 *     "download-dir" must be set to test for TR_EDUPLICATE.
     538 *
     539 * If setme_info is non-NULL and parsing is successful
     540 * (that is, if TR_EINVALID is not returned), then the parsed
     541 * metainfo is stored in setme_info and should be freed by the
     542 * caller via tr_metainfoFree().
     543 */
     544int tr_torrentParse( const tr_handle  * handle,
     545                     const tr_ctor    * ctor,
     546                     tr_info          * setme_info_or_NULL );
     547
     548/** Instantiate a single torrent.
     549    @return 0 on success,
     550            TR_EINVALID if the torrent couldn't be parsed, or
     551            TR_EDUPLICATE if there's already a matching torrent object. */
     552tr_torrent * tr_torrentNew( tr_handle      * handle,
     553                            const tr_ctor  * ctor,
     554                            int            * setmeError );
     555
     556/** @} */
     557
    426558/***********************************************************************
    427559***
     
    432564    @{ */
    433565
    434 /**
    435  * Iterate through the torrents.
    436  * Pass in in a NULL pointer to get the first torrent.
    437  */
     566/** Iterate through the torrents.
     567    Pass in a NULL pointer to get the first torrent.  */
    438568tr_torrent* tr_torrentNext( tr_handle *, tr_torrent * );
     569
     570/** Returns this torrent's unique ID.
     571    IDs are good as simple lookup keys, but are not persistent
     572    between sessions.  If you need that, use tr_info.hash or
     573    tr_info.hashString. */
     574int tr_torrentId( const tr_torrent * );
    439575
    440576/***********************************************************************
     
    535671
    536672
    537 /**
    538  *  Torrent Instantiation
    539  *
    540  *  Instantiating a tr_torrent had gotten more complicated as features were
    541  *  added.  At one point there were four functions to check metainfo and five
    542  *  to create tr_torrent.
    543  *
    544  *  To remedy this, a Torrent Constructor (struct tr_ctor) has been introduced:
    545  *  + Simplifies the API down to two (non-deprecated) functions.
    546  *  + You can set the fields you want; the system sets defaults for the rest.
    547  *  + You can specify whether or not your fields should supercede resume's.
    548  *  + We can add new features to tr_ctor without breaking tr_torrentNew()'s API.
    549  *
    550  *  All the tr_ctor{Get,Set}*() functions with a return value return
    551  *  an error number, or zero if no error occurred.
    552  *
    553  *  You must call one of the SetMetainfo() functions before creating
    554  *  a torrent with a tr_ctor.  The other functions are optional.
    555  *
    556  *  You can reuse a single tr_ctor to create a batch of torrents --
    557  *  just call one of the SetMetainfo() functions between each
    558  *  tr_torrentNew() call.
    559  *
    560  *  Every call to tr_ctorSetMetainfo*() frees the previous metainfo.
    561  */
    562 
    563 typedef enum
    564 {
    565     TR_FALLBACK, /* indicates the ctor value should be used only
    566                     in case of missing resume settings */
    567 
    568     TR_FORCE, /* indicates the ctor value should be used
    569                  regardless of what's in the resume settings */
    570 }
    571 tr_ctorMode;
    572 
    573 struct tr_benc;
    574 
    575 tr_ctor* tr_ctorNew                    ( const tr_handle  * handle);
    576 
    577 void     tr_ctorFree                   ( tr_ctor        * ctor );
    578 
    579 void     tr_ctorSetSave                ( tr_ctor        * ctor,
    580                                          int     saveMetadataInOurTorrentsDir );
    581 
    582 void     tr_ctorSetDeleteSource       ( tr_ctor        * ctor,
    583                                          uint8_t          doDelete );
    584 
    585 int      tr_ctorSetMetainfo            ( tr_ctor        * ctor,
    586                                          const uint8_t  * metainfo,
    587                                          size_t           len );
    588 
    589 int      tr_ctorSetMetainfoFromFile    ( tr_ctor        * ctor,
    590                                          const char     * filename );
    591 
    592 int      tr_ctorSetMetainfoFromHash    ( tr_ctor        * ctor,
    593                                          const char     * hashString );
    594 
    595 void     tr_ctorSetPeerLimit           ( tr_ctor        * ctor,
    596                                          tr_ctorMode      mode,
    597                                          uint16_t         peerLimit  );
    598 
    599 /**
    600  * Set the download folder for the torrent being added with this ctor.
    601  * @see tr_ctorSetDownloadDir()
    602  * @see tr_sessionInitFull()
    603  */
    604 void     tr_ctorSetDownloadDir         ( tr_ctor        * ctor,
    605                                          tr_ctorMode      mode,
    606                                          const char     * directory );
    607 
    608 void     tr_ctorSetPaused              ( tr_ctor        * ctor,
    609                                          tr_ctorMode      mode,
    610                                          uint8_t          isPaused );
    611 
    612 int      tr_ctorGetPeerLimit           ( const tr_ctor  * ctor,
    613                                          tr_ctorMode      mode,
    614                                          uint16_t       * setmeCount );
    615 
    616 int      tr_ctorGetPaused              ( const tr_ctor  * ctor,
    617                                          tr_ctorMode      mode,
    618                                          uint8_t        * setmeIsPaused );
    619 
    620 int      tr_ctorGetDownloadDir         ( const tr_ctor  * ctor,
    621                                          tr_ctorMode      mode,
    622                                          const char    ** setmeDownloadDir );
    623 
    624 int      tr_ctorGetMetainfo            ( const tr_ctor  * ctor,
    625                                          const struct tr_benc ** setme );
    626 
    627 int      tr_ctorGetSave                ( const tr_ctor  * ctor );
    628  
    629 int      tr_ctorGetDeleteSource        ( const tr_ctor  * ctor,
    630                                          uint8_t        * setmeDoDelete );
    631 
    632 /* returns NULL if tr_ctorSetMetainfoFromFile() wasn't used */
    633 const char* tr_ctorGetSourceFile       ( const tr_ctor  * ctor );
    634 
    635 /**
    636  * Returns this torrent's unique ID.
    637  * IDs are allocated when the torrent is constructed and are
    638  * good until tr_sessionClose() is called.
    639  */
    640 int tr_torrentId( const tr_torrent * );
    641 
    642 typedef struct tr_info tr_info;
    643 
    644 /**
    645  * Parses the specified metainfo.
    646  * Returns TR_OK if it parsed and can be added to Transmission.
    647  * Returns TR_EINVALID if it couldn't be parsed.
    648  * Returns TR_EDUPLICATE if it parsed but can't be added.
    649  *     "download-dir" must be set to test for TR_EDUPLICATE.
    650  *
    651  * If setme_info is non-NULL and parsing is successful
    652  * (that is, if TR_EINVALID is not returned), then the parsed
    653  * metainfo is stored in setme_info and should be freed by the
    654  * caller via tr_metainfoFree().
    655  */
    656 int tr_torrentParse( const tr_handle  * handle,
    657                      const tr_ctor    * ctor,
    658                      tr_info          * setme_info_or_NULL );
    659 
    660 /**
    661  * Instantiate a single torrent.
    662  */
    663 #define TR_EINVALID     1
    664 #define TR_EDUPLICATE   2
    665 tr_torrent * tr_torrentNew( tr_handle      * handle,
    666                             const tr_ctor  * ctor,
    667                             int            * setmeError );
    668 
    669 
    670673const tr_info * tr_torrentInfo( const tr_torrent * );
    671674
     
    751754int tr_torrentCanManualUpdate( const tr_torrent * );
    752755
    753 /***********************************************************************
    754  * tr_torrentStat
    755  ***********************************************************************
    756  * Returns a pointer to an tr_stat structure with updated information
    757  * on the torrent. The structure belongs to libtransmission (do not
    758  * free it) and is guaranteed to be unchanged until the next call to
    759  * tr_torrentStat.
    760  * The interface should call this function every second or so in order
    761  * to update itself.
    762  **********************************************************************/
    763 typedef struct tr_stat tr_stat;
     756/** Return a pointer to an tr_stat structure with updated information
     757    on the torrent.  This is typically called by the GUI clients every
     758    second or so to get a new snapshot of the torrent's status. */
    764759const tr_stat * tr_torrentStat( tr_torrent * );
     760
     761/** Like tr_torrentStat(), but only recalculates the statistics if it's
     762    been longer than a second since they were last calculated.  This can
     763    reduce the CPU load if you're calling tr_torrentStat() frequently. */
    765764const tr_stat * tr_torrentStatCached( tr_torrent * );
    766765
     
    923922};
    924923
     924/**
     925 * The current status of a torrent.
     926 * @see tr_torrentStat()
     927 */
    925928struct tr_stat
    926929{
     930    /** The torrent's unique Id.
     931        @see tr_torrentId() */
    927932    int id;
    928933
     934    /** The torrent's current status */
    929935    tr_torrent_status status;
    930936
     937    /** Our current announce URL, or NULL if none.
     938        This URL may change during the session if the torrent's
     939        metainfo has multiple trackers and the current one
     940        becomes unreachable. */
    931941    char * announceURL;
     942
     943    /** Our current scrape URL, or NULL if none.
     944        This URL may change during the session if the torrent's
     945        metainfo has multiple trackers and the current one
     946        becomes unreachable. */
    932947    char * scrapeURL;
    933948
     949    /** The error status for this torrent.  0 means everything's fine. */
    934950    tr_errno error;
     951
     952    /** Typically an error string returned from the tracker. */
    935953    char errorString[128];
    936954
    937     /* [0..1] */
     955    /** When tr_stat.status is TR_STATUS_CHECK or TR_STATUS_CHECK_WAIT,
     956        this is the percentage of how much of the files has been
     957        verified.  When it gets to 1, the verify process is done.
     958        Range is [0..1]
     959        @see tr_stat.status */
    938960    float recheckProgress;
    939961
    940     /* [0..1] */
     962    /** How much has been downloaded of the entire torrent.
     963        Range is [0..1] */
    941964    float percentComplete;
    942965
    943     /* [0..1] */
     966    /** How much has been downloaded of the files the user wants.  This differs
     967        from percentComplete if the user wants only some of the torrent's files.
     968        Range is [0..1]
     969        @see tr_stat.leftUntilDone */
    944970    float percentDone;
    945971
    946     /* KiB/s */
     972    /** Download speed in KiB/s */
    947973    float rateDownload;
    948974
    949     /* KiB/s */
     975    /** Upload speed in KiB/s */
    950976    float rateUpload;
    951977
    952978 #define TR_ETA_NOT_AVAIL -1
    953979 #define TR_ETA_UNKNOWN -2
    954     /* seconds */
     980    /** Estimated number of seconds left until the torrent is done,
     981        or TR_ETA_NOT_AVAIL or TR_ETA_UNKNOWN */
    955982    int eta;
    956983
     984    /** Number of peers that the tracker says this torrent has */
    957985    int peersKnown;
     986
     987    /** Number of peers that we're connected to */
    958988    int peersConnected;
     989
     990    /** How many peers we found out about from the tracker, or from pex,
     991        or from incoming connections, or from our resume file. */
    959992    int peersFrom[TR_PEER_FROM__MAX];
     993
     994    /** Number of peers that are sending data to us. */
    960995    int peersSendingToUs;
     996
     997    /** Number of peers that we're sending data to */
    961998    int peersGettingFromUs;
     999
     1000    /** Number of seeders that the tracker says this torrent has */
    9621001    int seeders;
     1002
     1003    /** Number of leechers that the tracker says this torrent has */
    9631004    int leechers;
     1005
     1006    /** Number of finished downloads that the tracker says torrent has */
    9641007    int completedFromTracker;
    9651008
    966     /* Byte count of all the piece data we'll have downloaded when we're done.
    967      * whether or not we have it yet. [0...tr_info.totalSize] */
     1009    /** Byte count of all the piece data we'll have downloaded when we're done,
     1010       whether or not we have it yet. [0...tr_info.totalSize] */
    9681011    uint64_t sizeWhenDone;
    9691012
    970     /* Byte count of how much data is left to be downloaded until
    971      * we're done -- that is, until we've got all the pieces we wanted.
    972      * [0...tr_info.sizeWhenDone] */
     1013    /** Byte count of how much data is left to be downloaded until
     1014       we're done -- that is, until we've got all the pieces we wanted.
     1015       [0...tr_info.sizeWhenDone] */
    9731016    uint64_t leftUntilDone;
    9741017
    975     /* Byte count of all the piece data we want and don't have yet,
    976      * but that a connected peer does have. [0...leftUntilDone] */
     1018    /** Byte count of all the piece data we want and don't have yet,
     1019       but that a connected peer does have. [0...leftUntilDone] */
    9771020    uint64_t desiredAvailable;
    9781021
    979     /* Byte count of all the corrupt data you've ever downloaded for
    980      * this torrent.  If you're on a poisoned torrent, this number can
    981      * grow very large. */
     1022    /** Byte count of all the corrupt data you've ever downloaded for
     1023       this torrent.  If you're on a poisoned torrent, this number can
     1024       grow very large. */
    9821025    uint64_t corruptEver;
    9831026
    984     /* Byte count of all data you've ever uploaded for this torrent. */
     1027    /** Byte count of all data you've ever uploaded for this torrent. */
    9851028    uint64_t uploadedEver;
    9861029
    987     /* Byte count of all the non-corrupt data you've ever downloaded
    988      * for this torrent.  If you deleted the files and downloaded a second time,
    989      * this will be 2*totalSize.. */
     1030    /** Byte count of all the non-corrupt data you've ever downloaded
     1031        for this torrent.  If you deleted the files and downloaded a second
     1032        time, this will be 2*totalSize.. */
    9901033    uint64_t downloadedEver;
    9911034
    992     /* Byte count of all the checksum-verified data we have for this torrent. */
     1035    /** Byte count of all the checksum-verified data we have for this torrent. */
    9931036    uint64_t haveValid;
    9941037
    995     /* Byte count of all the partial piece data we have for this torrent.
    996      * As pieces become complete, this value may decrease as portions of it are
    997      * moved to `corrupt' or `haveValid'. */
     1038    /** Byte count of all the partial piece data we have for this torrent.
     1039        As pieces become complete, this value may decrease as portions of it
     1040        are moved to `corrupt' or `haveValid'. */
    9981041    uint64_t haveUnchecked;
    9991042
    1000     /* This is the unmodified string returned by the tracker in response
    1001      * to the torrent's most recent scrape request.  If no request was
    1002      * sent or there was no response, this string is empty. */
     1043    /** This is the unmodified string returned by the tracker in response
     1044       to the torrent's most recent scrape request.  If no request was
     1045       sent or there was no response, this string is empty. */
    10031046    char scrapeResponse[256];
    10041047
    1005     /* The unmodified string returned by the tracker in response
    1006      * to the torrent's most recent scrape request.  If no request was
    1007      * sent or there was no response, this string is empty. */
     1048    /** The unmodified string returned by the tracker in response
     1049       to the torrent's most recent scrape request.  If no request was
     1050       sent or there was no response, this string is empty. */
    10081051    char announceResponse[256];
    10091052
    1010     /* Time the most recent scrape request was sent,
    1011      * or zero if one hasn't been sent yet. */
     1053    /** Time the most recent scrape request was sent,
     1054       or zero if one hasn't been sent yet. */
    10121055    time_t lastScrapeTime;
    10131056
    1014     /* Time when the next scrape request will be sent.
    1015      * This value is always a valid time. */
     1057    /** Time when the next scrape request will be sent.
     1058       This value is always a valid time. */
    10161059    time_t nextScrapeTime;
    10171060
    1018     /* Time the most recent announce request was sent,
    1019      * or zero if one hasn't been sent yet. */
     1061    /** Time the most recent announce request was sent,
     1062       or zero if one hasn't been sent yet. */
    10201063    time_t lastAnnounceTime;
    10211064
    1022     /* Time when the next reannounce request will be sent,
    1023      * or zero if the torrent is stopped. */
     1065    /** Time when the next reannounce request will be sent,
     1066       or zero if the torrent is stopped. */
    10241067    time_t nextAnnounceTime;
    10251068
    1026     /* if the torrent is running, this is the time at which
    1027      * the client can manually ask the torrent's tracker
    1028      * for more peers.  otherwise, the value is zero. */
     1069    /** If the torrent is running, this is the time at which
     1070       the client can manually ask the torrent's tracker
     1071       for more peers.  otherwise, the value is zero. */
    10291072    time_t manualAnnounceTime;
    10301073
     1074    /** A very rough estimate in KiB/s of how quickly data is being
     1075        passed around between all the peers we're connected to.
     1076        Don't put too much weight in this number. */
    10311077    float swarmSpeed;
    10321078
    10331079#define TR_RATIO_NA  -1
    10341080#define TR_RATIO_INF -2
    1035     /* TR_RATIO_INF, TR_RATIO_NA, or a regular ratio */
     1081    /** TR_RATIO_INF, TR_RATIO_NA, or a regular ratio */
    10361082    float ratio;
    1037    
    1038     uint64_t startDate;
    1039     uint64_t activityDate;
     1083   
     1084    /** When the torrent was last started. */
     1085    time_t startDate;
     1086
     1087    /** The last time we uploaded or downloaded piece data on this torrent. */
     1088    time_t activityDate;
    10401089};
    10411090
  • trunk/macosx/Torrent.m

    r5911 r5922  
    14781478- (NSDate *) dateActivity
    14791479{
    1480     uint64_t date = fStat->activityDate;
    1481     return date != 0 ? [NSDate dateWithTimeIntervalSince1970: date / 1000] : fDateActivity;
     1480    time_t date = fStat->activityDate;
     1481    return date != 0 ? [NSDate dateWithTimeIntervalSince1970: date] : fDateActivity;
    14821482}
    14831483
     
    14901490- (int) stalledMinutes
    14911491{
    1492     uint64_t start;
     1492    time_t start;
    14931493    if ((start = fStat->startDate) == 0)
    14941494        return -1;
    14951495   
    1496     NSDate * started = [NSDate dateWithTimeIntervalSince1970: start / 1000],
     1496    NSDate * started = [NSDate dateWithTimeIntervalSince1970: start],
    14971497            * activity = [self dateActivity];
    14981498   
Note: See TracChangeset for help on using the changeset viewer.