Commit fd1c701f authored by Summer Stapleton's avatar Summer Stapleton
Browse files

Removed handling of trailing 'Z' from iTime and updated truth data

parent caf7ae78
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -49,27 +49,17 @@ namespace Isis {
  /**
   * Constructs a iTime object and initializes it to the time from the argument.  
   *  
   * This constructor will (temporarily) strip the Z off of the end of an input UTC-formatted time 
   * if it is present. This time format is used by PDS4, but not presently supported by NAIF calls, 
   * in particular str2et_c, which is used by this class.  
   *  
   * @param time A time string formatted in standard UTC or similar format.
   *             Example:"2000/12/31 23:59:01.6789" or "2000-12-31T23:59:01.6789" or
   *             "2000-12-31T23:59:01.6789Z"
   *             Example:"2000/12/31 23:59:01.6789" or "2000-12-31T23:59:01.6789"
   */
  iTime::iTime(const QString &time) {
    LoadLeapSecondKernel();

    QString tempTime = time; 
    if (QString::compare(time.at(time.size() - 1), "Z", Qt::CaseInsensitive) == 0) {
      tempTime = time.left(time.size() - 1);
    }

    NaifStatus::CheckErrors();

    // Convert the time string to a double ephemeris time
    SpiceDouble et;
    str2et_c(tempTime.toLatin1().data(), &et);
    str2et_c(time.toLatin1().data(), &et);

    p_et = et;
    NaifStatus::CheckErrors();
+0 −19
Original line number Diff line number Diff line
@@ -18,25 +18,6 @@ Unit test for iTime
   Et          = 94781765.3
   UTC         = 2003-01-02T12:15:01.1234

  Test of date = 2003/01/02 12:15:01.1234Z
   Year        = 2003
   Year        = 2003
   Month       = 1
   Month       = 1
   Day         = 2
   Day         = 2
   Hour        = 12
   Hour        = 12
   Minute      = 15
   Minute      = 15
   Second      = 1.1234
   Second      = 1.1234
   Day of Year = 2
   Day of Year = 2
   Et          = 94781765.307363
   Et          = 94781765.3
   UTC         = 2003-01-02T12:15:01.1234

  Test of date = 2000-12-31T23:59:01.6789
   Year        = 2000
   Year        = 2000
+0 −29
Original line number Diff line number Diff line
@@ -42,35 +42,6 @@ int main(int argc, char *argv[]) {
  }


  try {
    cout << endl;
    cout << setprecision(9);
    QString test = "2003/01/02 12:15:01.1234Z";
    iTime *time = new iTime(test);
    cout << "  Test of date = " << test << endl;
    cout << "   Year        = " << time->YearString() << endl;
    cout << "   Year        = " << time->Year() << endl;
    cout << "   Month       = " << time->MonthString() << endl;
    cout << "   Month       = " << time->Month() << endl;
    cout << "   Day         = " << time->DayString() << endl;
    cout << "   Day         = " << time->Day() << endl;
    cout << "   Hour        = " << time->HourString() << endl;
    cout << "   Hour        = " << time->Hour() << endl;
    cout << "   Minute      = " << time->MinuteString() << endl;
    cout << "   Minute      = " << time->Minute() << endl;
    cout << "   Second      = " << time->SecondString() << endl;
    cout << "   Second      = " << time->Second() << endl;
    cout << "   Day of Year = " << time->DayOfYearString() << endl;
    cout << "   Day of Year = " << time->DayOfYear() << endl;
    cout << "   Et          = " << time->EtString() << endl;
    cout << "   Et          = " << time->Et() << endl;
    cout << "   UTC         = " << time->UTC() << endl;
  }
  catch(IException &error) {
    error.print();
  }


  double saveEt = 0.0;
  try {
    cout << endl;