Ignore:
Timestamp:
Jun 16, 2016 6:22:33 PM (4 years ago)
Author:
ldelgass
Message:

Fix time reported for render_info,render_stop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nanovis/trunk/nanovisServer.cpp

    r5492 r6390  
    167167serverStats(int code)
    168168{
    169     double start, finish;
    170169    char buf[BUFSIZ];
    171170    Tcl_DString ds;
    172171    int result;
    173172
    174     {
    175         struct timeval tv;
    176 
    177         /* Get ending time.  */
    178         gettimeofday(&tv, NULL);
    179         finish = CVT2SECS(tv);
    180         tv = g_stats.start;
    181         start = CVT2SECS(tv);
    182     }
     173    /* Get ending time.  */
     174    struct timeval now;
     175    gettimeofday(&tv, NULL);
     176    double session_time = CVT2SECS(now) - CVT2SECS(g_stats.start);
     177
    183178    /*
    184179     * Session information:
     
    186181     *   - Process ID
    187182     *   - Hostname where server is running
    188      *   - Start date of session
    189      *   - Start date of session in seconds
     183     *   - Stop date of session
     184     *   - Stop date of session in seconds
    190185     *   - Number of frames returned
    191186     *   - Number of bytes total returned (in frames)
     
    217212    /* date */
    218213    Tcl_DStringAppendElement(&ds, "date");
    219     strcpy(buf, ctime(&g_stats.start.tv_sec));
     214    strcpy(buf, ctime(&now.tv_sec));
    220215    buf[strlen(buf) - 1] = '\0';
    221216    Tcl_DStringAppendElement(&ds, buf);
    222217    /* date_secs */
    223218    Tcl_DStringAppendElement(&ds, "date_secs");
    224     sprintf(buf, "%ld", g_stats.start.tv_sec);
     219    sprintf(buf, "%ld", now.tv_sec);
    225220    Tcl_DStringAppendElement(&ds, buf);
    226221    /* num_frames */
     
    242237    /* session_time */
    243238    Tcl_DStringAppendElement(&ds, "session_time");
    244     sprintf(buf, "%g", finish - start);
     239    sprintf(buf, "%g", session_time);
    245240    Tcl_DStringAppendElement(&ds, buf);
    246241    /* status */
     
    273268    }
    274269    Tcl_DStringAppend(&ds, "\n", -1);
    275     int f = getStatsFile(NULL);
    276     result = writeToStatsFile(f, Tcl_DStringValue(&ds),
     270    int fd = getStatsFile(NULL);
     271    result = writeToStatsFile(fd, Tcl_DStringValue(&ds),
    277272                              Tcl_DStringLength(&ds));
    278     close(f);
     273    close(fd);
    279274    Tcl_DStringFree(&ds);
    280275    return result;
Note: See TracChangeset for help on using the changeset viewer.