13#include "Preference.h" 
   18#include "SpecialPixel.h" 
   19#include "NaifStatus.h" 
   25  bool iTime::p_lpInitialized = 
false;
 
   49    str2et_c(time.toLatin1().data(), &et);
 
 
   72    str2et_c(time.toLatin1().data(), &et);
 
 
  166  iTime iTime::operator +(
const double &secondsToAdd)
 const {
 
  173  void iTime::operator +=(
const double &secondsToAdd) {
 
  175      p_et += secondsToAdd;
 
  179  iTime 
operator +(
const double &secondsToAdd, iTime time) {
 
  180    time += secondsToAdd;
 
  187  iTime iTime::operator -(
const double &secondsToSubtract)
 const {
 
  189    tmp -= secondsToSubtract;
 
  194  double iTime::operator -(
const iTime &iTimeToSubtract)
 const {
 
  195    return p_et - iTimeToSubtract.p_et;
 
  199  void iTime::operator -=(
const double &secondsToSubtract) {
 
  201      p_et -= secondsToSubtract;
 
  205  iTime 
operator -(
const double &secondsToSubtract, iTime time) {
 
  206    time -= secondsToSubtract;
 
  234    timout_c(
p_et, 
"YYYY", 5, out);
 
 
  258    timout_c(
p_et, 
"MM", 3, out);
 
 
  282    timout_c(
p_et, 
"DD", 3, out);
 
 
  306    timout_c(
p_et, 
"HR", 3, out);
 
 
  330    timout_c(
p_et, 
"MN", 3, out);
 
 
  342    osec.setf(ios::fixed);
 
  343    osec << setprecision(precision) << 
Second();
 
  344    QString sSeconds(osec.str().c_str());
 
  345    sSeconds = sSeconds.remove(QRegExp(
"(\\.0*|0*)$"));
 
  347    if(sSeconds.isEmpty()) sSeconds = 
"0";
 
 
  361    timout_c(
p_et, 
"SC.#######::RND", 256, out);
 
 
  385    timout_c(
p_et, 
"DOY", 4, out);
 
 
  425  void iTime::setEt(
double et) {
 
  432  void iTime::setUtc(QString utcString) {
 
  434    if ( utcString.contains(
"T") && 
 
  435         !utcString.contains(
"-") && 
 
  436         !utcString.contains(
":")) { 
 
  437      QString dateString = utcString.split(
"T").front();
 
  438      dateString.insert(4, 
"-");
 
  441      if (dateString.size() > 8) {
 
  442        dateString.insert(7, 
"-");
 
  445      QString timeString = utcString.split(
"T").back();
 
  447      if (timeString.size() < 6) {
 
  448        timeString.resize(6, 
'0');
 
  450      timeString.insert(2, 
":");
 
  451      timeString.insert(5, 
":");
 
  453      utcString = dateString + 
"T" + timeString;
 
  460    utc2et_c(utcString.toLatin1().data(), &et);
 
  474    if(p_lpInitialized) 
return;
 
  477    Isis::PvlGroup &dataDir = Isis::Preference::Preferences().findGroup(
"DataDirectory");
 
  478    QString baseDir = dataDir[
"Base"];
 
  479    baseDir += 
"/kernels/lsk/";
 
  480    FileName leapSecond(baseDir + 
"naif????.tls");
 
  481    QString leapSecondName;
 
  486      QString msg = 
"Unable to load leadsecond file. Either the data area is not set or there are no naif####.tls files present";
 
  491    furnsh_c(leapSecondName.toLatin1().data());
 
  494    p_lpInitialized = 
true;
 
 
  505    time_t startTime = time(NULL);
 
  506    struct tm *tmbuf = gmtime(&startTime);
 
  508    strftime(timestr, 80, 
"%Y-%m-%dT%H:%M:%S", tmbuf);
 
  509    return (QString) timestr;
 
 
  521    time_t startTime = time(NULL);
 
  522    struct tm *tmbuf = localtime(&startTime);
 
  524    strftime(timestr, 80, 
"%Y-%m-%dT%H:%M:%S", tmbuf);
 
  525    return (QString) timestr;
 
 
File name manipulation and expansion.
 
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
 
FileName highestVersion() const
Searches the directory specified in the file name for the highest version of the file name.
 
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
 
Adds specific functionality to C++ strings.
 
int ToInteger() const
Returns the object string as an integer.
 
double ToDouble() const
Returns the floating point value the IString represents.
 
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
 
Contains multiple PvlContainers.
 
Parse and return pieces of a time string.
 
QString HourString() const
Returns the hour portion of the time as a string.
 
bool operator>=(const iTime &time)
Compare two iTime objects for greater than or equal.
 
int Hour() const
Returns the hour portion of the time as an int.
 
QString DayOfYearString() const
Returns the day of year portion of the time as a string.
 
double Second() const
Returns the second portion of the time as a double.
 
bool operator!=(const iTime &time)
Compare two iTime objects for inequality.
 
QString EtString() const
Returns the ephemeris time (TDB) representation of the time as a string.
 
static QString CurrentLocalTime()
Returns the current local time This time is taken directly from the system clock, so if the system cl...
 
void operator=(const QString &time)
Changes the value of the iTime object.
 
QString DayString() const
Returns the dat portion of the time as a string.
 
int Day() const
Returns the day portion of the time as an int.
 
QString SecondString(int precision=8) const
Returns the second portion of the time as a string.
 
bool operator>(const iTime &time)
Compare two iTime objects for greater than.
 
QString MonthString() const
Returns the month portion of the time as a string.
 
QString MinuteString() const
Returns the minute portion of the time as a string.
 
bool operator<(const iTime &time)
Compare two iTime objects for less than.
 
int Month() const
Returns the month portion of the time as an int.
 
static QString CurrentGMT()
Returns the current Greenwich Mean iTime The time is based on the system time, so it is only as accur...
 
int Minute() const
Returns the minute portion of the time as an int.
 
int DayOfYear() const
Returns the day of year portion of the time as an int.
 
QString YearString() const
Returns the year portion of the time as a string.
 
QString UTC(int precision=8) const
Returns the internally stored time, formatted as a UTC time.
 
bool operator<=(const iTime &time)
Compare two iTime objects for less than or equal.
 
double p_et
The ephemeris representaion of the original string passed into the constructor or the operator= membe...
 
void LoadLeapSecondKernel()
Uses the Naif routines to load the most current leap second kernel.
 
int Year() const
Returns the year portion of the time as an int.
 
iTime()
Constructs an empty iTime object.
 
bool operator==(const iTime &time)
Compare two iTime objects for equality.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
Coordinate operator+(const Coordinate &A, const Coordinate &B)
Summation operator for Coordinate.
 
bool IsSpecial(const double d)
Returns if the input pixel is special.
 
Coordinate operator-(const Coordinate &A, const Coordinate &B)
Subtraction operator for Coordinate.
 
Namespace for the standard library.