Commit e222d18e authored by Christopher Combs's avatar Christopher Combs
Browse files

Fixed ConnectTime being NAN when running isis2std with format=jp2. Fixes #4618.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7751 41f8697f-d340-4b68-9986-7bafba869bb8
parent db7867a1
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ extern int errno;
#include <QCoreApplication>
#include <QLocalSocket>
#include <QString>
#include <QTime>

#include "Application.h"
#include "Constants.h"    //is this still used in this class?
@@ -136,6 +137,7 @@ namespace Isis {
      if (!p_ui->IsInteractive()) {
        // Get the starting wall clock time
        p_datetime = DateTime(&p_startTime);
        m_connectTime.start();
        p_startClock = clock();

        if (p_applicationForceGuiApp) {
@@ -205,6 +207,7 @@ namespace Isis {

              if (i != 0) {
                p_datetime = DateTime(&p_startTime);
                m_connectTime.start();
                p_startClock = clock();
                p_startDirectIO = DirectIO();
                p_startPageFaults = PageFaults();
@@ -268,6 +271,7 @@ namespace Isis {
    if (p_ui->IsInteractive()) {
      p_startClock = clock();
      p_datetime = DateTime(&p_startTime);
      m_connectTime.start();
      //cerr << "History GUI start clock=" << p_startClock << " time=" << p_startTime << endl;
    }
    PvlObject history(p_ui->ProgramName());
@@ -287,16 +291,14 @@ namespace Isis {

    return history;
  }

//
  /**
   * Creates accounting PvlGroup
   *
   * @return PvlGroup Accounting Group
   */
  PvlGroup Application::Accounting() {
    // Grab the ending time to compute connect time
    time_t endTime = time(NULL);
    double seconds = difftime(endTime, p_startTime);
    double seconds = m_connectTime.elapsed() / 1000.0;
    int minutes = (int)(seconds / 60.0);
    seconds = seconds - minutes * 60.0;
    int hours = minutes / 60;
+6 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <iostream>
#include <fstream>
#include <QString>
#include <QTime>
#include <string>
#include <ctime>

@@ -110,6 +111,8 @@ namespace Isis {
   *                          with using QApplication. References #575.
   *   @history 2016-08-15 Adam Paquette - Reset locale after QApplication or
   *                          QCoreApplication are instantiated. Fixes #3908.
   *   @history 2017-06-08 Christopher Combs - Changed object used to calculate
   *                          connectTime from  a time_t to a QTime. Fixes #4618.
   */
  class Application : public Environment {
    public:
@@ -161,6 +164,7 @@ namespace Isis {
      QLocalSocket *p_connectionToParent; //!<
      time_t p_startTime;                 //!<
      clock_t p_startClock;               //!<
      QTime m_connectTime;                //!< Used to calculate program's run time
      QString p_datetime;                 //!<
      int p_startDirectIO;                //!<
      int p_startPageFaults;              //!<