Isis 3.0 Developer's Reference (API) |
Home |
00001 #ifndef Time_h 00002 #define Time_h 00003 00025 #include <string> 00026 00027 #include "naif/SpiceUsr.h" 00028 #include "naif/SpiceZfc.h" 00029 #include "naif/SpiceZmc.h" 00030 00031 #include "Filename.h" 00032 00033 namespace Isis { 00034 class iString; 00035 00071 class iTime { 00072 public: 00073 // constructor 00074 iTime(); 00075 iTime(const std::string &time); 00076 00082 iTime(const double time) { 00083 if(!p_lpInitialized) 00084 LoadLeapSecondKernel(); 00085 00086 p_et = time; 00087 } 00088 00089 // destructor 00090 ~iTime() {}; 00091 00092 void operator=(const std::string &time); 00093 void operator=(const char *time); 00094 void operator=(const double time); 00095 00096 bool operator>=(const iTime &time); 00097 bool operator<=(const iTime &time); 00098 bool operator>(const iTime &time); 00099 bool operator<(const iTime &time); 00100 bool operator!=(const iTime &time); 00101 bool operator==(const iTime &time); 00102 00103 iTime operator +(const double &secondsToAdd) const; 00104 void operator +=(const double &secondsToAdd); 00105 friend iTime operator +(const double &secondsToAdd, iTime time); 00106 00107 // Return the year 00108 std::string YearString() const; 00109 int Year() const; 00110 std::string MonthString() const; 00111 int Month() const; 00112 std::string DayString() const; 00113 int Day() const; 00114 std::string HourString() const; 00115 int Hour() const; 00116 std::string MinuteString() const; 00117 int Minute() const; 00118 std::string SecondString() const; 00119 double Second() const; 00120 std::string DayOfYearString() const; 00121 int DayOfYear() const; 00122 std::string EtString() const; 00123 00127 double Et() const { 00128 return p_et; 00129 } 00130 00131 std::string UTC() const; 00132 static std::string CurrentGMT(); 00133 static std::string CurrentLocalTime(); 00134 00135 void setEt(double et); 00136 void setUtc(iString utcString); 00137 00138 private: 00139 double p_et; 00142 void LoadLeapSecondKernel(); 00143 void UnloadLeapSecondKernel(); 00144 00145 static bool p_lpInitialized; 00146 }; 00147 }; 00148 00149 #endif 00150