Isis 3 Programmer Reference
iTime.h
Go to the documentation of this file.
1 #ifndef Time_h
2 #define Time_h
3 
25 #include <string>
26 
27 #include <SpiceUsr.h>
28 #include <SpiceZfc.h>
29 #include <SpiceZmc.h>
30 
31 #include "FileName.h"
32 
33 class QString;
34 
35 namespace Isis {
36 
78  class iTime {
79  public:
80  // constructor
81  iTime();
82  iTime(const QString &time);
83 
89  iTime(const double time) {
90  if(!p_lpInitialized)
92 
93  p_et = time;
94  }
95 
96  // destructor
97  ~iTime() {};
98 
99  void operator=(const QString &time);
100  void operator=(const char *time);
101  void operator=(const double time);
102 
103  bool operator>=(const iTime &time);
104  bool operator<=(const iTime &time);
105  bool operator>(const iTime &time);
106  bool operator<(const iTime &time);
107  bool operator!=(const iTime &time);
108  bool operator==(const iTime &time);
109 
110  iTime operator +(const double &secondsToAdd) const;
111  void operator +=(const double &secondsToAdd);
112  friend iTime operator +(const double &secondsToAdd, iTime time);
113 
114  iTime operator -(const double &secondsToSubtract) const;
115  double operator -(const iTime &iTimeToSubtract) const;
116  void operator -=(const double &secondsToSubtract);
117  friend iTime operator -(const double &secondsToSubtract, iTime time);
118 
119  // Return the year
120  QString YearString() const;
121  int Year() const;
122  QString MonthString() const;
123  int Month() const;
124  QString DayString() const;
125  int Day() const;
126  QString HourString() const;
127  int Hour() const;
128  QString MinuteString() const;
129  int Minute() const;
130  QString SecondString(int precision=8) const;
131  double Second() const;
132  QString DayOfYearString() const;
133  int DayOfYear() const;
134  QString EtString() const;
135 
139  double Et() const {
140  return p_et;
141  }
142 
143  QString UTC(int precision=8) const;
144  static QString CurrentGMT();
145  static QString CurrentLocalTime();
146 
147  void setEt(double et);
148  void setUtc(QString utcString);
149 
150  private:
151  double p_et;
154  void LoadLeapSecondKernel();
155 
156  static bool p_lpInitialized;
157  };
158 };
159 
160 #endif
iTime()
Constructs an empty iTime object.
Definition: iTime.cpp:45
QString HourString() const
Returns the hour portion of the time as a string.
Definition: iTime.cpp:305
int Minute() const
Returns the minute portion of the time as an int.
Definition: iTime.cpp:338
static QString CurrentLocalTime()
Returns the current local time This time is taken directly from the system clock, so if the system cl...
Definition: iTime.cpp:503
Parse and return pieces of a time string.
Definition: iTime.h:78
int Hour() const
Returns the hour portion of the time as an int.
Definition: iTime.cpp:314
bool operator<(const iTime &time)
Compare two iTime objects for less than.
Definition: iTime.cpp:152
bool operator>=(const iTime &time)
Compare two iTime objects for greater than or equal.
Definition: iTime.cpp:118
bool operator>(const iTime &time)
Compare two iTime objects for greater than.
Definition: iTime.cpp:140
int Year() const
Returns the year portion of the time as an int.
Definition: iTime.cpp:242
int Day() const
Returns the day portion of the time as an int.
Definition: iTime.cpp:290
QString UTC(int precision=8) const
Returns the internally stored time, formatted as a UTC time.
Definition: iTime.cpp:418
iTime(const double time)
Constructs a iTime object and initializes it to the time from the argument.
Definition: iTime.h:89
QString DayOfYearString() const
Returns the day of year portion of the time as a string.
Definition: iTime.cpp:384
bool operator==(const iTime &time)
Compare two iTime objects for equality.
Definition: iTime.cpp:174
QString EtString() const
Returns the ephemeris time (TDB) representation of the time as a string.
Definition: iTime.cpp:409
QString DayString() const
Returns the dat portion of the time as a string.
Definition: iTime.cpp:281
QString MinuteString() const
Returns the minute portion of the time as a string.
Definition: iTime.cpp:329
int Month() const
Returns the month portion of the time as an int.
Definition: iTime.cpp:266
bool operator!=(const iTime &time)
Compare two iTime objects for inequality.
Definition: iTime.cpp:163
double Second() const
Returns the second portion of the time as a double.
Definition: iTime.cpp:369
double p_et
The ephemeris representaion of the original string passed into the constructor or the operator= membe...
Definition: iTime.h:151
bool operator<=(const iTime &time)
Compare two iTime objects for less than or equal.
Definition: iTime.cpp:129
QString SecondString(int precision=8) const
Returns the second portion of the time as a string.
Definition: iTime.cpp:353
QString MonthString() const
Returns the month portion of the time as a string.
Definition: iTime.cpp:257
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void LoadLeapSecondKernel()
Uses the Naif routines to load the most current leap second kernel.
Definition: iTime.cpp:461
void operator=(const QString &time)
Changes the value of the iTime object.
Definition: iTime.cpp:79
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
QString YearString() const
Returns the year portion of the time as a string.
Definition: iTime.cpp:233
int DayOfYear() const
Returns the day of year portion of the time as an int.
Definition: iTime.cpp:393
static QString CurrentGMT()
Returns the current Greenwich Mean iTime The time is based on the system time, so it is only as accur...
Definition: iTime.cpp:487